+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Edit Built-in Page Templates in visual studio.

Edit Built-in Page Templates in visual studio.

2 posts, 0 answered
  1. Prasanna
    Prasanna avatar
    3 posts
    Registered:
    30 Jan 2015
    12 Mar 2015
    Link to this post

    Hi Team, 

    I need to edit built-in basic page templates in visual studio. help me in either way,

    1. How to edit basic page templates of sitefinity in visual studio (using thunder).

    2. How to edit a custom page template in visual studio, which is created by using sitefinity basic template not by using the master page.

    when im connecting sitefinity with thunder i can create and update new templates from visual studio and it only displays the list of page templates which is created from master page, and the sitefinity basic page templates are not displayed in sitefinity explorer / website templates. how can i solve my problem.

     

    Thanks in advance.

  2. Ivan D. Dimitrov
    Ivan D. Dimitrov avatar
    310 posts
    Registered:
    26 Mar 2015
    16 Mar 2015
    Link to this post
    Hello Prasanna,

    There is no way for you to edit the default page templates other than through code. The templates you see in Sitefinity by default are build in the SiteInitializer class when your project is being created. For example here is the code for the 1 Column, Header, Footer template that ships with the product:
    protected virtual void Create1ColumnHeaderFooter(HierarchicalTaxon node, short ordinal, bool restoreToDefaultTemplate = false)
           {
               var template = this.GetTemplate(SiteInitializer.TemplateId1ColumnHeaderFooter, restoreToDefaultTemplate);
               template.Name = "OneColumnHeaderFooter";
               Res.SetLstring(template.Title, typeof(PageResources), "OneColumnHeaderFooter");
               template.Category = node.Id;
               template.Ordinal = ordinal;
     
               var present = this.PageManager.CreatePresentationItem<TemplatePresentation>();
               present.DataType = Presentation.HtmlDocument;
               present.Name = "master";
               var resName = "Telerik.Sitefinity.Resources.Pages.Frontend.aspx";
               present.Data = ControlUtilities.GetTextResource(resName, this.assemblyInfo);
               template.Presentation.Add(present);
     
               present = this.PageManager.CreatePresentationItem<TemplatePresentation>();
               present.DataType = Presentation.ImageUrl;
               present.Name = "icon";
               present.Theme = "Default";
               present.Data = "Telerik.Sitefinity.Resources.Themes.Default.Images.PageTemplates.1ColumnHeaderFooter.gif";
               template.Presentation.Add(present);
     
               var sibling = Guid.Empty;
               var layout = new LayoutControl();
               layout.Layout = ControlUtilities.ToVppPath("Telerik.Sitefinity.Resources.Templates.Layouts.Labeled.Column1TemplateHeader.ascx");
               var ctrlData = this.PageManager.CreateControl<PageModel.TemplateControl>(false);
               ctrlData.ObjectType = layout.GetType().FullName;
               ctrlData.PlaceHolder = "Body";
               ctrlData.SiblingId = sibling;
               sibling = ctrlData.Id;
               ctrlData.Caption = "Header";
               ctrlData.Description = "Represents the header of the template.";
               this.PageManager.ReadProperties(layout, ctrlData);
               this.PageManager.SetControlId(template, ctrlData);
               ctrlData.SetDefaultPermissions(this.PageManager);
               template.Controls.Add(ctrlData);
     
               layout = new LayoutControl();
               layout.Layout = ControlUtilities.ToVppPath("Telerik.Sitefinity.Resources.Templates.Layouts.Labeled.Column1Template.ascx");
               ctrlData = this.PageManager.CreateControl<PageModel.TemplateControl>(false);
               ctrlData.ObjectType = layout.GetType().FullName;
               ctrlData.PlaceHolder = "Body";
               ctrlData.SiblingId = sibling;
               sibling = ctrlData.Id;
               ctrlData.Caption = "Content";
               ctrlData.Description = "Represents the content area of the template.";
               this.PageManager.ReadProperties(layout, ctrlData);
               this.PageManager.SetControlId(template, ctrlData);
               ctrlData.SetDefaultPermissions(this.PageManager);
               template.Controls.Add(ctrlData);
     
               layout = new LayoutControl();
               layout.Layout = ControlUtilities.ToVppPath("Telerik.Sitefinity.Resources.Templates.Layouts.Labeled.Column1TemplateFooter.ascx");
               ctrlData = this.PageManager.CreateControl<PageModel.TemplateControl>(false);
               ctrlData.ObjectType = layout.GetType().FullName;
               ctrlData.PlaceHolder = "Body";
               ctrlData.SiblingId = sibling;
               sibling = ctrlData.Id;
               ctrlData.Caption = "Footer";
               ctrlData.Description = "Represents the footer of the template.";
               this.PageManager.ReadProperties(layout, ctrlData);
               this.PageManager.SetControlId(template, ctrlData);
               ctrlData.SetDefaultPermissions(this.PageManager);
               template.Controls.Add(ctrlData);
               this.CreateTemplateInvariantLanguageData(template);
           }

    If you want to edit it in any way, using Thunder or Visual Studio will not do. They are relevant for Master pages only.

    The way you can alter this template is via our Page Templates API. This way you can get an instance of the template. If you want to add controls to it, please review this documentation article and alter the Page instance to be a PageTemplate one.

    Regards,
    Ivan D. Dimitrov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
2 posts, 0 answered