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

	/**
	 * Make object instance and enable the 'autoglobal' and 
	 * 'allowphp' option
	 */
	$temp = new Template(Array('allowphp' => true, 'autoglobal' => true));

	/**
	 * Define some variables outside the template
	 */
	$variable = 'Hello World';

	/**
	 * Add a custom piece of code, that will show the value 
	 * of our variable when compiling
	 */
	$temp->addcache("<?php echo(\$variable); ?>");

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