Login   Register  
PHP Classes
elePHPant
Icontem

File: demo/index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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
 

Contents

Class file image Download
<?php
/**
 * Define a root path to the core
 */
define"TEMPL_CORE_PATH",    dirnamedirname__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->addOutput
                    
$templ->getTemplate"mySkinSet"'testFunction'
                                                array( 
"SOME VALUE" 
                    ) 
    );

    
// 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.

$templ->pagePrint
            array( 
'page_title' => "TEMPLAGE ENGINE TEST" 
);

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

?>