PHP Classes

File: demo/index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Nick Tompson  >  Flexible Template Engine  >  demo/index.php  >  Download  
File: demo/index.php
Role: Example script
Content type: text/plain
Description: Demo script for using the template engine.
Class: Flexible Template Engine
Template processing engine
Author: By
Last change:
Date: 6 years ago
Size: 1,552 bytes


Class file image Download
 * Define a root path to the core
define( "TEMPL_CORE_PATH", dirname( dirname( __FILE__ ) ) . "/" );

// Load the template engine core.
require TEMPL_CORE_PATH . "templateEngine.class.php";

// Init the object and the main template engine.
// You can specific one argument to the initTemplateEngine method. This argument will tell the template engine to use a specific theme.

// Leaving that argument blank will use the default theme.

$templ =new templateEngine();
$templ->initTemplateEngine( );

// We dont really need to check for the return value of this function, but I did anyway.
if( $templ->loadTemplateSet( "mySkinSet" ) !== FALSE )
// Here we add output to be printed by calling one of the HTML functions in our skinset (mySkinSet)
    // and assign one argument to it.

$templ->getTemplate( "mySkinSet", 'testFunction',

// We can also call a HTML function by:
    //$templ->loadedSets['mySkinSet']->testFunction( "SOME VALUE" ); // Just like a regular PHP function call.

// Now we end off the page with the final print function.
// Page title is a standard variable that we can pass to this function.

'page_title' => "TEMPLAGE ENGINE TEST" )

// If you have custom macros in your templates, you can add them into a second argument, e.g:
            array( 'page_title' => "TEMPLATE ENGINE TEST" ),
            array( 'CUSTOM_MACRO_1' => "VALUE_1" ),