Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

66 lines (48 sloc) 1.649 kb

Template Page Configuration

Each page using the template should configure the template, include the template, and then generate page content:


// include guard so configuration and include only happen once
if (!isset($TEMPLATE)) {
    // configure the template
    $TITLE = 'My Page Title';
    // include the template
    include '';

// generate page content


Template processing

This is the processing flow for a page that loads the template. Note that page.php is loaded more than one time, which is why the include guard is so important.

# request begins
    configure template
    include ''
        include ''
        include ''
            # load site configuration
            include DOCUMENT_ROOT/
            set $TEMPLATE
        include ''
            # output header
            include page.php
               # skip configuration/include
               generate content
            # output footer
            # exit

Using template functions before including the template

Template functions are normally only defined after the template has been included. Sometimes you want to use these functions before including the template. One example would be using the param() function during or before template configuration:

if (!isset($TEMPLATE)) {

    include_once '';
    $id = param('id');
    // look up title in database

    $TITLE = '...';
    // include the template
    include '';

// generate page content
Jump to Line
Something went wrong with that request. Please try again.