ѡ̳

 找回密码
 ע
搜索
查看: 27|回复: 0
打印 上一主题 下一主题

修复多站点下 包含文件问题 $siteid = get_siteid();

[复制链接]

789

主题

1158

帖子

4197

积分

Ա

Rank: 9Rank: 9Rank: 9

积分
4197
跳转到指定楼层
¥
发表于 2018-2-8 13:47:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/**
* 模板调用
*
* @param $module
* @param $template
* @param $istag
* @return unknown_type
*/
function template($module = 'content', $template = 'index', $style = '') {

        if(strpos($module, 'plugin/')!== false) {
                $plugin = str_replace('plugin/', '', $module);
                return p_template($plugin, $template,$style);
        }
        $module = str_replace('/', DIRECTORY_SEPARATOR, $module);
        if(!empty($style) && preg_match('/([a-z0-9\-_]+)/is',$style)) {
        } elseif (empty($style) && !defined('STYLE')) {
                if(defined('SITEID')) {
                        $siteid = SITEID;
                } else {
                        $siteid = param::get_cookie('siteid');
                }

                //if (!$siteid) $siteid = 1;  
              $siteid =  get_siteid();  //统一使用函数

                $sitelist = getcache('sitelist','commons');
                if(!empty($siteid)) {
                        $style = $sitelist[$siteid]['default_style'];
                }
        } elseif (empty($style) && defined('STYLE')) {
                $style = STYLE;
        } else {
                $style = 'default';
        }
        if(!$style) $style = 'default';
        $template_cache = pc_base::load_sys_class('template_cache');
        $compiledtplfile = PHPCMS_PATH.'caches'.DIRECTORY_SEPARATOR.'caches_template'.DIRECTORY_SEPARATOR.$style.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.$template.'.php';
        if(file_exists(PC_PATH.'templates'.DIRECTORY_SEPARATOR.$style.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.$template.'.html')) {
                if(!file_exists($compiledtplfile) || (@filemtime(PC_PATH.'templates'.DIRECTORY_SEPARATOR.$style.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.$template.'.html') > @filemtime($compiledtplfile))) {
                        $template_cache->template_compile($module, $template, $style);
                }
        } else {
                $compiledtplfile = PHPCMS_PATH.'caches'.DIRECTORY_SEPARATOR.'caches_template'.DIRECTORY_SEPARATOR.'default'.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.$template.'.php';
                if(!file_exists($compiledtplfile) || (file_exists(PC_PATH.'templates'.DIRECTORY_SEPARATOR.'default'.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.$template.'.html') && filemtime(PC_PATH.'templates'.DIRECTORY_SEPARATOR.'default'.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.$template.'.html') > filemtime($compiledtplfile))) {
                        $template_cache->template_compile($module, $template, 'default');
                } elseif (!file_exists(PC_PATH.'templates'.DIRECTORY_SEPARATOR.'default'.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.$template.'.html')) {
                        showmessage('Template does not exist.'.DIRECTORY_SEPARATOR.$style.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.$template.'.html');
                }
        }
        return $compiledtplfile;
}

回复

使用道具 举报

您需要登录后才可以回帖 登录 | ע

本版积分规则

QQ|Archiver|ֻ|С|ѡ̳

GMT+8, 2026-5-2 06:01 , Processed in 0.077592 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表
0.0905s