Location: PHPKode > scripts > Template Processor > template-processor/example_settings.php
<?php
	/**
	 * Load class
	 */
	require_once("./template.class.php");

	/**
	 * Make object instance
	 */
	$temp = new Template();

	/**
	 * This is a very odd example, but its show how the 
	 * get_configuration() function works
	 * (return as object, without tempvars included)
	 */
	$cfg = $temp->get_configuration(true);

	/**
	 * Using set_option() allows us to change 
	 * options that has already been set by default or by the constructor
	 *
	 *	Note, the set_option() does not support Resource/Object/Array datatypes!
	 *
	 * In this exampe we want to turn on the "allowphp" option, which 
	 * makes it possible to compile php code in all templates.
	 *
	 * Since we wanted to see how the get configuration worked, then 
	 * we make an if to test before setting it
	 */
	if(!$cfg->allowphp)
	{
		$temp->set_option('allowphp', true);
	}

	/**
	 * We could also have passed it as the constructors 
	 * first parameter when making an instance of the class
	 * like this:
	 *
	 *	$temp = new Template(Array('allowphp' => true));
	 *
	 * Or here when we're adding multiple configuration options 
	 * in one call:
	 *
	 *	$temp = new Template(Array('allowphp' => true, 'vartype' => 'php'));
	 *
	 */

	/**
	 * Add a piece of code to the cache and compile it to 
	 * test that "allowphp" is working correctly.
	 */
	$temp->addcache('<?php echo("Hello World"); ?>');

	/**
	 * Compile
	 */
	$temp->compile();
?>
Return current item: Template Processor