Thursday, September 11, 2014

Basic Sitecore Page Creation

Step 1: Create two base templates “Page Title” and “Page Description”
 Step 2: Create a page inheriting from two templates

Step 3: Insert standard values by selecting “Builder” tab of data template and clicking on “Options” in the main menu.

Step 4: Create a layout and put necessary place holders.

In DemoLayout.aspx

<div id="MainPanel">

      <sc:placeholder key="main" runat="server" />


Placeholder is an area of the page to support the user adding controls. Placeholders can be placed on layouts, sublayouts and view renderings.

Step 5: Create a sub layout
 In PageData.ascx, put two literal controls

<asp:Literal ID="ltPageTitle" runat="server"></asp:Literal><br />
<asp:Literal ID="ltPageDescription" runat="server"></asp:Literal>

In PageData.ascx.cs

Item i = Sitecore.Context.Item;
if(i != null)
            ltPageTitle.Text = i.Fields["Page Title"].Value;
            ltPageDescription.Text = i.Fields["Page Description"].Value;

Step 6: Create a place holder setting item and allow above sublayout. Placeholder settings provide all of the details for the placeholder to Page Editor including the controls that can be added.

Step 7: Assign layout, sub layout and placeholder settings to the template.
To set layout, go to standard values, click on edit and set the layout

Click on controls and set the sub layout

Set the placeholder setting

Step 8: Set Insert Options for the home item template to “Page” template.

Step 9: Create a page based on the template.

No comments:

Post a Comment