Skip to content
tracend edited this page Jan 1, 2012 · 10 revisions

You can assume templates are the different layouts a website has. In most cases all templates have the same theme and thus use most of the same assets.

Generally a user expects only one theme for every website, so to keep the web root clean from files that are not used, mutli-theme support is out of scope.

The Template class is responsible of loading the right template file and has three main methods exposed to display content in a template - head(), body() and foot()

Template:head()

This generates the content for the head tag - meta tags, links to css and more. All controllers/plugins that have a head.php view will be compiled and output through here.

Template:body()

The body() method generates the main content area, looping through all the data sets, gathered by the controller, while applying the view individually selected for each one.

Template::foot()

Not to be confused with the footer tag , here is where all the script files are included. As with the head() method, all loaded controllers and plugins that have a foot.php view will be compiled and displayed here.

Extend

Adding new templates is as simple as creating new files in the "html/template/" folder. They will appear automatically when you are editing a page, where you'll have the opportunity to pick a different template for every page.

Some controllers may require a special template - to automate that requirement, if a template has the same file name as the controller (ex. archives.php), it will automatically become the selected tempalte for that controller.

Clone this wiki locally