Dynamic Page Creation (in SQL)
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.
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
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;
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