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

	/**
	 * Construct
	 */
	$temp = new Template();

	/**
	 * v1.0.2 introduced a new interface of variable types that can be 
	 * replaced via the replace_var(s)() and/or assign_var(s)() functions
	 *
	 * The phpvars and tempvars options does not exists as of v1.0.2 and 
	 * was replaced with 'vartype' which not only accepts 'php' and '' 
	 * (leave empty to use tempvars), but also 'html' and 'xhtml' look 
	 * a like variables.
	 *
	 *	php:
	 *		$variable
	 *
	 *	html:
	 *		<variable>
	 *
	 *	xhtml:
	 *		<variable />
	 *
	 *	temp:
	 *		{variable}
	 *
	 * Is the new variable replacements
	 */

	/**
	 * Lets say we wanna use 'xhtml' as our vartype for a small 
	 * 'Hello World' script
	 */

	/**
	 * Set configuration
	 */
	$temp->set_configuration(Array('vartype' => 'xhtml'));

	/**
	 * Add a cache template
	 */
	$temp->addcache('<helloworld />');

	/**
	 * Replace
	 */
	$temp->replace_var('helloworld', 'Hello World');

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