Web Form Master Pages

Get full power of Master Pages in C1 CMS

As an ASP.NET developers, you expect to use Master Pages in an ASP.NET-based CMS. You can use Master Pages in C1 CMS via the contribution project at http://compositec1contrib.codeplex.com/.

To start using Master Pages:

  1. Install and run the latest version of C1 CMS.
  2. Install the Contribution.CompositeC1Contrib.MasterPages package. (NOTE: For C1 CMS version 2.1.1 or earlier, please use C1 CMS Contrib Core instead.)
  3. Open the website and create one or more master pages in ~/App_Data/PageTemplates/ (where XHTML template files are located).

Important: Please pay attention to the naming of the master pages and the use of content placeholders.

Note: Alternatively, you can download and compile the latest version of the C1 CMS Conrib source code and do the manual installation.

Naming of Master Pages

The name of the master page must be the same as the page (layout) templates found in the Layout perspective. Say, you have the FrontPage template in C1 CMS so its counterpart master page should be named "FrontPage.master":

~/App_Data/PageTemplates/FrontPage.master

C1 CMS will use a master page instead of the XHTML-based page template with the same name. If there is no matching master page, C1 CMS will continue using the XHTML template.

Elements specific to Master Pages in C1 CMS

The following C1 CMS-related elements are availalble in Master Page-based templates (.master):

  • <rendering:placeholder />
  • <rendering:title />
  • <rendering:description />

Please note that all these elements use rendering as its namespace.

Content Placeholders

To add content to pages rendered via master pages, you should use content placeholders (<rendering:placeholder id="content" title="Content" default="true" runat="server" />) with the same IDs used in their matching XHTML templates (<rendering:placeholder id="content" title="Content" default="true" />). You can have as many placeholders as you need.

CMS Functions in Master Pages

You can call regular CMS Functions in master pages as you do in XHTML templates. You should only specify runat="server" in the <f:function/> element:

<f:function name="Composite.Navigation.LanguageSwitcher"  runat="server">
    <f:param name="Mode">TranslatedOrHomePages</f:param>
    <f:param name="ShowCurrent">False</f:param>
    <f:param name="Format">NativeName</f:param>
</f:function>

Note: The use of <rendering:function /> element around <f:function/> is obsolete.

Page Titles in Master Pages

You can use the <rendering:title runat="server" /> element in a Master Page template to show the page's title.

Page Descriptions in Master Pages

You can use the <rendering:description runat="server" /> element in a Master Page template to show the page's description.