Location: PHPKode > scripts > XtremeTemplate > xtremetemplate/xtreme.template.php
<?
/**
* @package XtremeCMS
* @author A H M Shahnur Alam
* @email hide@address.com
* @copyright InteliSoft Solutions
* @class XtremeTemplate 
* @uses As a simple but strong template engine
*/
class XtremeTemplate{
       var $Vars = array();
       var $Functions;   
       var $TemplateDir = 'templates/';
       var $CurrentTemplate = 'default/';     
       
       /**
       * @method XtremeTemplate
       * @access Public
       * @uses Constructor - Initiate Template Engine
       * @param mixed $TData
       * @return XtremeTemplate
       */
       function XtremeTemplate($CurrentTemplate='default'){           
            $this->TemplateDir = "templates/";            
            $this->CurrentTemplate = $CurrentTemplate.'/';
       }
       
       /**
       * @method Assign
       * @access Public
       * @uses Used to make a variable accesible from template
       * @param mixed $Name
       * @param mixed $Value
       */
       function Assign($Name,$Value){
            $this->Vars[$Name] = $Value;
       }
       
       /**
       * @method Fetch
       * @access Public
       * @uses Compiling the template data
       * @param mixed $Template
       * @return string
       */
       function Fetch($Template){
           $this->Vars['TemplateUrl'] = $this->TemplateDir.$this->CurrentTemplate;
           extract($this->Vars);
           ob_start();
           if(file_exists($Template))
           include($Template);       
           else if(file_exists($this->TemplateDir.$Template))    
           include($this->TemplateDir.$Template);
           else
           echo '<h4>Sorry, File Not Found ('.$Template.')!!!</h4>';
           $contents =  ob_get_contents();
           ob_end_clean();
           return $contents;
       }
       
       /**
       * @method Display
       * @access Public
       * @uses Display the template data
       * @param mixed $Template
       */
       function Display($Template){
          echo $this->Fetch($Template);
       }
}
?>
Return current item: XtremeTemplate