Dynamic Page Creation (in SQL)

Posted by Community Admin on 05-Aug-2018 17:57

Dynamic Page Creation (in SQL)

All Replies

Posted by Community Admin on 06-Apr-2011 00:00

Does sql exist somewhere to create pages in tsql?  I am using CodeSmith to create some admin controls for a custom database, and it would be nice to have Codesmith Create the tsql to create the pages (maybe even drop the controls on the page too).  I have a ton of tables that require a searchable interface page and subsequent edit form page.  I don't want to have to do that manually through the gui.

Posted by Community Admin on 06-Apr-2011 00:00

Hello Scott ,

We use data layer Open Access ORM and we do no use direct sql queries. We work with the API and we have methods that create objects which we use. You can use the API to create pages, but you should create a tool that will export the entire data you have.

www.sitefinity.com/.../sitefinity-essentials-pages.html

Greetings,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 06-Apr-2011 00:00

I think the following code is what you want me to use.  However, when I put that into a C# ascx, I get a squiggly under the GET(); on the following line.  Bool does not contain a definition for Get(); error.

SaveChanges().Get();

public PageNode CreateNewFrontendPage(string name, string title, string urlName)

    //We need a page manager object so we can get a template for the page
    //but Template facade will be introduced with the official release

    Telerik.Sitefinity.Modules.Pages.PageManager pManager = new Telerik.Sitefinity.Modules.Pages.PageManager();
    Guid templateGuid = pManager.GetTemplates().First().Id;
    PageNode newPageNode = App.WorkWith().Page()
                             .CreateNewStandardPage(PageLocation.Frontend)
                             .Do(p =>
                            
                                 p.Name = name;
                                 p.Title = title;
                                 //unique url of the page
                                 //this property is required
                                 p.UrlName = urlName;
                                 p.ShowInNavigation = true;
                                 p.LastModified = DateTime.UtcNow;
                                 p.DateCreated = DateTime.UtcNow;
                                 //set menu name
                                 p.Page.Title = name;
                                 //set title which appears in page header
                                 p.Page.HtmlTitle = title;
                                 p.Description = "Some description";
                             )
                             .CheckOut()
        //set the page template
                                .SetTemplateTo(templateGuid)
        //when we are done with editing we want to make the page live
        //the other option is to CheckIn() however this only save changes
        //to a new page draft without publishing it
                                .Publish()
                            .SaveChanges().Get();
    SiteMapBase.Cache.Flush();
    return newPageNode;

Posted by Community Admin on 11-Apr-2011 00:00

Hello Scott Bradley,

We have had some changes in the Pages Fluent API. Can you please try using SaveAndContinue:

Telerik.Sitefinity.Modules.Pages.PageManager pManager = new Telerik.Sitefinity.Modules.Pages.PageManager();
Guid templateGuid = pManager.GetTemplates().First().Id;
PageNode newPageNode = App.WorkWith().Page()
                         .CreateNewStandardPage(PageLocation.Frontend)
                         .Do(p =>
                         
                             p.Name = name;
                             p.Title = title;
                             //unique url of the page
                             //this property is required
                             p.UrlName = urlName;
                             p.ShowInNavigation = true;
                             p.LastModified = DateTime.UtcNow;
                             p.DateCreated = DateTime.UtcNow;
                             //set menu name
                             p.Page.Title = name;
                             //set title which appears in page header
                             p.Page.HtmlTitle = title;
                             p.Description = "Some description";
                         )
                         .CheckOut()
    //set the page template
                            .SetTemplateTo(templateGuid)
    //when we are done with editing we want to make the page live
    //the other option is to CheckIn() however this only save changes
    //to a new page draft without publishing it
                            .Publish()
                        .SaveAndContinue().Get();
SiteMapBase.Cache.Flush();c

We will update the developer's guide to reflect the changes.

Greetings,
Radoslav Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed