Recommended Links

Common For all pages

This section shows you how you can have editable content which is the same throughout the site ( NOTE: It is language specific ) .All the navs below are generated using snippets that are included with the framework, edit this content to see how it was generated

Sub Nav:

Main Nav:

Footer Nav:

Unique Per Page


A Template is a php file which contains the overall site structure, it can contain template variables like {templateVariable} which is basically a placeholder for the actual content.

All template files must be placed under the '/views/template/' directory.

A template file can be set using $this->setTemplate('TemplateFile'); withing a controller function and then can be displayed using $this->display($parserArguments = array());

NOTE: The 'parserArguments' is an associative array which contains a list of template variable, template value pairs i.e array( 'templateVariable1' => 'templateValue1', 'templateVariable2' => 'templateValue2', ... )

The Parser uses this to parse the template and replace all the template variables with their respective values.

The parser automaticly creates a list of template variable value pairs from the 'Config.php' file and the 'SiteMap.xml' file for the current page.

Which meens if you use a template variable like { pageTitle } it will be replaced with the page title of the current page from the SiteMap.xml file and if you use a template variable { siteURL } it will convert that to the actual siteURL which it gets from the 'Config.php' file.

So you can add custom variables to the 'Config.php' file and Custom attributes to the node of the SiteMap.xml file which you can then access directly using template variable {CustomConfigVariable} and {CustomNodeAttribute} respectively.

The 'BaseController' Class exposes the following functions to work with templates:

  • protected function setTemplate($templateName)
  • protected function display($templateVariables = array())


    public function index()
      //Set the protocol ( You can have different pages run on different protocols )

        Set the language, this is used by the loadMainContent function.
        Values can be whatever you call the folder /views/content/[Language]/
        ( I recommend using standard Language Code's
        for example for canadian english use en-CA  )

      //Set the template to be used ( Different pages can have different templates )

      //Loads the content file: /views/contents/en-CA/home.php
      $templateVars['rightContent'] = $this->loadMainContent('home');
      //Finally, parse the template template 1 using $templateVars

Site Powered by Mac's PHP MVC Framework Framework of the future
Design downloaded from Free website templates, layouts, and tools.