<?php

/*
Plugin Name: TemplateLite
Template URI: http://templatelite.sourceforge.net
Description: TemplateLite模版引擎插件
Author: 云中雾
Version: 1.0
Author URI: http://www.20488.com/
*/
function TemplateLite($templateFile, $templateVar, $charset, $varPrefix = '')
{
    $templateFile = substr($templateFile, strlen(TMPL_PATH));
    include_once "class.template.php";
    $tpl = new Template_Lite();
    $tpl->template_dir = TMPL_PATH;
    $tpl->compile_dir = CACHE_PATH;
    $tpl->cache_dir = TEMP_PATH;
    $tpl->assign($templateVar);
    $tpl->display($templateFile);
    return;
}
if ('LITE' == strtoupper(C('TMPL_ENGINE_TYPE'))) {
    add_compiler('Templite', 'TemplateLite');
}
<?php

/*
Plugin Name: SmartyTemplate
Template URI: http://smarty.php.net
Description: Smarty模版引擎插件
Author: 流年 修正 云中雾
Version: 1.0
Author URI: http://blog.liu21st.com/
*/
function SmartyTemplate($templateFile, $templateVar, $charset, $varPrefix = '')
{
    $templateFile = substr($templateFile, strlen(TMPL_PATH));
    include_once "Smarty.class.php";
    $tpl = new Smarty();
    $tpl->caching = true;
    $tpl->template_dir = TMPL_PATH;
    $tpl->compile_dir = CACHE_PATH;
    $tpl->cache_dir = TEMP_PATH;
    $tpl->assign($templateVar);
    $tpl->display($templateFile);
    return;
}
if ('SMARTY' == strtoupper(C('TMPL_ENGINE_TYPE'))) {
    add_compiler('Smarty', 'SmartyTemplate');
}
Example #3
0
<?php

/*
Plugin Name: EaseTemplate
Template URI: http://www.systn.com
Description: EaseTemplate模版引擎插件
Author: 云中雾
Version: 1.0
Author URI: http://www.20488.com/
*/
function EaseTemplate($templateFile, $templateVar, $charset, $varPrefix = '')
{
    $templateFile = substr($templateFile, strlen(TMPL_PATH), -5);
    $CacheDir = substr(CACHE_PATH, 0, -1);
    $TemplateDir = substr(TMPL_PATH, 0, -1);
    include PLUGIN_PATH . "EaseTemplate/template.php";
    $tpl = new EaseTemplate(array('CacheDir' => $CacheDir, 'TemplateDir' => $TemplateDir, 'TplType' => 'html'));
    $tpl->set_var($templateVar);
    $tpl->set_file($templateFile);
    $tpl->p();
    //$tpl->inc_list();
    return;
}
if ('EASE' == strtoupper(C('TMPL_ENGINE_TYPE'))) {
    add_compiler('Ease', 'EaseTemplate');
}