Page Templates and Syntax
Page layout templates are aspx files with includes and calls to helpers. They are used from the
Currently, we have only content zones, so a template can look like this:
<link rel="stylesheet" type="text/css" href="<%= ResolveUrl("~/Content/StyleSheet.css") %>" />
<%= Html.Include(“header”) %>
<%= Html.IncludeZone(“Content”) %>
<%= Html.IncludeZone(“Right sidebar") %>
<%= Html.Include(“footer”) %>
<%= Html.IncludeAdmin() %>
The helpers used above are:
- Html.Include(string includeName) includes the partial view whose name is specified.
- Html.IncludeZone(string zoneName) includes a named content zone.
- Html.IncludeAdmin() includes the admin link if the user is logged in as administrator.
Template meta-data is stored directly in the template file as server comments. They are in a simple key-value format. Keys and values are separated by a colon character:
name: Two column layout
description: This has a main content area and a sidebar on the right.
zones: Content, Right sidebar
The keys in the metadata are case-insensitive.
Metadata values can be on multiple lines.
The fields that are not recognized are put in a dictionary so that they are still accessible from code.
The last piece of metadata, which is optional, is the thumbnail representation for it that is used in the template selection screen and in the edit page screen. This is a PNG or GIF image that has the same name as the template file and that is stored in the