Using Page Template Features

Make use of Page Template Features in Master Page templates

In C1 CMS v.4.0 or later, you can add content to multiple Page Template Features in the Layout perspective and then include those features in templates.

To include a page template feature in a Master Page template, use the <c1:PageTemplateFeature/> control and specify the name of the feature to include in its Name attribute.

For example, if you have a page template feature called "Aside Column", this is how you can include it in your template:

.master

<%@ Master Language="C#" AutoEventWireup="true" 
    CodeFile="UsePageTemplateFeatures.master.cs" Inherits="MyPageTemplate" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>
        <c1:Title runat="server" />
    </title>
</head>
<body>
    <div class="row">
        
    </div>
    <div class="row">
        <div class="span8">
            <c1:Render ID="Render1" Markup="<%# Content %>" runat="server" />
        </div>
        <div class="span4">
            <c1:PageTemplateFeature Name="Aside Column" runat="server" />
        </div>
    </div>
</body>
</html>
 
Download the sample

.master.cs

using System;
using Composite.Core.Xml;
using Composite.Core.PageTemplates;
using Composite.Plugins.PageTemplates.MasterPages;
using Composite.Functions;
using System.Collections.Generic;

public partial class MyPageTemplate : MasterPagePageTemplate
{
    public override Guid TemplateId
    {
        get { return new Guid("25de2e26-ab15-4490-8501-b3e8dcb90822"); }
    }

    [Placeholder(Id = "content", Title = "Main Content", IsDefault = true)]
    public XhtmlDocument Content { get; set; }

    protected void Page_Load(object sender, EventArgs e)
    {

    }
}
 
Download the sample