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 Content file is a php file which contains HTML and may contain template variables of there own like {templateVariable}.

All content files must be placed under the '/views/contents/[LanguageFolder]/' directory.

A content file is loaded using $this->loadMainContent('ContentFileName', $parserArguments = array()); which returns the result of executing and parsing the content file 'ContentFileName'

NOTE: The 'LanguageFolder' is for localization, you can have as many folders as you want and then set the language either in the 'Config.php' file by changing the variable

public $siteLanguage = '[LanguageFolder]';

or at runtime using $this->setLanguage('LanguageFolder') which tells the framework to look under the folder 'LanguageFolder' for the content 'ContentFileName'

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 contents:

  • protected function loadMainContent($contentName, array $customVariables = 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.