/**
 * 检测模板是否需要更新
 * @param string $main_tpl
 * @param string $sub_tpl
 * @param int $time_compare
 * @param string $cache_file
 * @param string $tpl_dir
 * @param string $file
 * @return bool
 */
function checkTplRefresh($main_tpl, $sub_tpl, $time_compare, $cache_file, $tpl_dir, $file)
{
    global $_FANWE;
    static $tpl_refresh = NULL;
    if ($tpl_refresh === NULL) {
        $tpl_refresh = $_FANWE['config']['output']['tpl_refresh'];
    }
    if (empty($time_compare) || $tpl_refresh == 1 || $tpl_refresh > 1 && !(TIMESTAMP % $tpl_refresh)) {
        if (empty($time_compare) || @filemtime(FANWE_ROOT . $sub_tpl) > $time_compare) {
            require_once fimport('class/template');
            $template = new Template();
            $template->parseTemplate($main_tpl, $tpl_dir, $file, $cache_file);
            return TRUE;
        }
    }
    return FALSE;
}
Example #2
0
 function get($file, $vars = null)
 {
     return Template::parseTemplate($file, $vars);
 }