SiteCake Templates
SiteCake uses templates to render pages. Every page that could be viewed or edited is created using a page template. Page templates control all visual/design aspects of pages (page layout, content styling, etc.)
Without any special restrictions, a page template is, or in case of a PHP template, could be evaluated into a valid HTML document. Standard HTML elements (HTML tags, CSS class names, etc.) are used to define templates. This means that virtually any existing static HTML page could be easily converted into a page template.
Content Containers
Any page template consists of one or more content areas - content containers. These containers represent editable areas on a page. The number of content containers per page template is not limited.
A content container is a DIV tag that has a special CSS class:
sc-content-[identifier]
where [identifier] represents container name. The following is a list of valid content container classes:
<div class=”sc-content-mainContent”/>
<div class=”content sc-content-central-content”/>
<div class=”blue article sc-content-article_2”/>
<div class=”left sc-content-leftContentBlock special-background”/>
Content containers cannot be nested.
In other words a container can not contain other container.
Each container has an unique identifier within a page
This means that every content container can be referenced only once in a page.
Same container identifier can be used on several pages.
Editing of any of these container instances with the same identifier will update all the other immediately. That way you can create repeating content blocks throughout the website. It is useful, for example, for footer links, contact data in side column, etc...
UTF8 Encoding
In order to support non-ASCII characters, and because JavaScript uses Unicode for string representation, SC page templates needs to be encoded in UTF8. That means, the page template’s <head> tag needs to contain the following:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Example Template
The following is an example of a simple page template:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Page Title</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class=”top sc-content-topContent”>
<img width=”530” height=”50” src=”images/top.jpg” />
<h1>Page Title</h1>
<p>lorem ipsum...</p>
</div>
<div class=”wrapper”>
<div class=”page-content sc-content-pageContent”>
<h2>Section title</h2>
<p>Normal text paragraph</p>
<h2 class=”blue-title”>Special section title</h2>
<p class=”code-block”>S paragraph with some code</p>
<p class=”special-style”>Another styled paragraph</p>
</div>
</div>
<div class=”footer sc-content-footer”>
<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ul>
</div>
</body>
</html>
Template Parsing and CSS Styles
While parsing page templates initially, SiteCake tries to extract existing content from the content containers and convert it into the initial content (in the edit mode). Only known content types are extracted in this process - the rest of content is ignored.
Except from being used as the initial content, the content present within content containers in a page template specifies possible CSS styles for content elements. In the previous page template example, there is the following container:
<div class=”page-content sc-content-pageContent”>
<h2>Section title</h2>
<p>Normal text paragraph</p>
<h2 class=”blue-title”>Special section title</h2>
<p class=”code-block”>S paragraph with some code</p>
<p class=”special-style”>Another styled paragraph</p>
</div>
In addition to the default style (when no CSS class is present), the second H2 tag defines an additional CSS style - blue-title. This CSS style could be applied to H2 tags, but only to those that are positioned in the pageContent container.
SiteCake does not modify template files. It parses them at start and at any detected update/change, and creates internal version of templates in sitecake-content/temp directory. The content of sitecake-content/temp can be deleted at any time. It will be recreated at the next page request.