Location: PHPKode > scripts > TPLManager > tplmanager/example2.php
<?php

function getTPLV_NAME(){ return 'John Q. Public'; }
function getTPLV_SUPPORTEMAIL(){ return 'hide@address.com'; }
function getTPLV_MY_NAME(){ return 'Gregory Patmore'; }

/**
 * example1.php 
 * Example usage of the TPLManager using the load-n-launch method
 * 
 * @author Gregory Patmore (mail at gregorypatmore dot com)
 * @version 1.0
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @package TPLManager
 * @access public
 */
try{
	print "Example Usage of the TPLManager class using the CREATE-N-LOOP method";
	
	/* Include the file. */
	include('tplmanager.class.php');	
	
	/* Create a new instance */
	$t = new TPLManager('thanks_email.tpl');	
	
	/* Retrieve the hotspot list */
	$spots = $t->getHotspotList();
	
	if(is_array($spots)){
		
		/* Loop through and assign a value */
		foreach($spots as $s){
			$func = 'getTPLV_' . strtoupper($s);
			if(function_exists($func))
				$t->setVal($s, $func());		
		}
		
		/* Retrieve the processed text */
		$procTxt = $t->getParsed();
		
		/* (Do something useful with it here) */
		print '<pre>' . $procTxt . '</pre>';
		exit;
		
	}else trigger_error('Template processing failed to find any hotspots to replace', E_USER_WARNING);

}catch(Exception $e){
	/* Do something with an error here */
	exit($e->getMessage());
}
?> 
Return current item: TPLManager