Location: PHPKode > scripts > Flexible Template Engine > flexible-template-engine/demo/index.php
<?php
/**
 * 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->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" 		  ),
);*/

?>
Return current item: Flexible Template Engine