Container template

From The Smartest Wiki
Jump to: navigation, search

A container template is a template used for page layout, and included on a page using a container.

Container templates are separated from other templates in Smartest, since there are other forms of template that are not used in this way.

Container templates are physically stored in Presentation/Layouts/. However, this folder is used for other types of template besides container templates.

Container templates can themselves contain <?sm:container name="...":?> tags, which means the layout of the document can be determined hierarchically. This hierarchy is visualised for you by Smartest on the Page elements tree.

The typical content of a container template might be something like this:

<div id="page-content">
  <h1><?sm:$this.page.title:?></h1>
  <?sm:placeholder name="main_text":?>
  <?sm:container name="sub_layout":?>
</div>

In the above example, this container template creates a <div> element inside which the content of the page would be placed. In this case, that page content is comprised of:

  • an <h1> tag, containing the page's title, via the $this template variable.
  • a placeholder called "main_text," which would contain the text of the page.
  • another container, called "sub_layout," for including a further template below the text, which could be defined differently for each page, or not defined at all.