Location: PHPKode > projects > Tagging manager > version 1.02/includes/template.php
<?php
/*  ============================================================
 *                              template.php 
 *                              -------------------
 *     Date                 : 15 june 2006
 *     E-mail               : hide@address.com
 *
 *     Version              : 1.0 (15/06/2006 - 09:50)
 *
 *     This a free software 
 *     licensed under GPL (General public license)
 *
    ============================================================ */

/**
 * Small simple template generator
 *
 * Just to seperate main logic/process from layout, still contains html
 * It parses the template/php in background and then returns this. you just have to echo it
 *
 * @author hide@address.com
 * @version 1.0
 * @package Forms
 */
        
    
/**
 * Small simple template object
 *
 */
 class Template {
    var $vars; // Holds all the template variables

		/**
 		* Template constructor
 		*
 		*	@param string $file location of template file
 		*/
    function Template($file = null) {
        $this->file = $file;
    }

		/**
 		* set: sets the variables in the template
 		*
 		*	@param string $name name of the variable you want to insert in the template
 		*	@param string $value value of the variable you want to insert in the template
 		*/
    function set($name, $value) {
        $this->vars[$name] = is_object($value) ? $value->fetch() : $value;
    }

		/**
 		* Processing of the template in background
 		*
 		*	@param string $file location of template file
 		* @param string $language location of language file
 		*
 		* @return mixed $contents returns parsed content (mostly just your html stuff)
 		*/
    function fetch($file = null,$language = null) {
    	
  			$root_path = './';
        if(!$file) $file = $this->file;
        extract($this->vars);          // Extract the vars to local namespace
        ob_start();                    // Start output buffering
        if($language) include($root_path.'language/' . $language); // Include the languagestuff
        include($file);                // Include the file
        $contents = ob_get_contents(); // Get the contents of the buffer
        ob_end_clean();                // End buffering and discard
        return $contents;              // Return the contents
    }
}


?>
Return current item: Tagging manager