Location: PHPKode > projects > Blackwolf CMF > projectBlackWolf/lib/Template/Subsystem.class.php
<?php
/* Please see the README and LICENSE files. */

/**
 * This is a small facade/API for the tmplate subsystem with common functions
 * for common tasks
 */

class Template_Subsystem implements System_Subsystem{

    ////////////////////////////////////////////////////////////////////////////
    // START CONFIGURABLE
    ////////////////////////////////////////////////////////////////////////////
    
    /**
     * The default theme
     * @var String
     */
    protected static $cur_theme_dir = "default";
    
    /**
     * The directory from main where templates are stored
     * @var String
     */
    protected static $template_dir = "../templates";    
    
    ////////////////////////////////////////////////////////////////////////////
    // STOP CONFIGURABLE
    ////////////////////////////////////////////////////////////////////////////
    
    /**
     * Get or set the current theme
     * 
     * @param String $theme The theme to set
     * @return String The current theme
     */
    public static function current_theme_dir($theme=NULL){
        self::$cur_theme_dir = is_null($theme)?self::$cur_theme_dir:$theme;
        return self::$cur_theme_dir;
     }
     
    /**
     * Get or set the template directory
     * 
     * @params String $dir The directory to set
     * @return String The current directory
     */
    public static function current_dir($dir=NULL){
        self::$template_dir = is_null($dir)?self::$template_dir:$dir;
        return self::$template_dir;
    }
    
    /**
     * Quickly parse some text
     * @param String $text
     * @param String[] $vars
     * @param Data_Model $model
     * @param Mixed[] $params
     * @return String 
     */
    public static function parse($text,$vars=NULL,$model=NULL,$params=NULL){
        $tp = new Template_Parser($text);
        return $tp->parse($vars,$model);
    }
    
    /**
     * Quickly parse a file
     * @param String $filename
     * @param String[] $vars
     * @param Data_Model $model
     * @param Mixed[] $params
     * @return String
     */
    public static function parse_file($filename,$vars=NULL,$model=NULL,$params=NULL){
        $tf = new Template_File($filename);
        $tfp = new Template_FileParser($tf);
        return $tfp->parse($vars,$model);
    }
}

?>
Return current item: Blackwolf CMF