zoukankan      html  css  js  c++  java
  • phpcms源码跟踪(1)

    本次跟踪解决几个问题:

    1、缓存文件从哪里来,过程中被删除了怎么办

    2、模板html是如何被引入的

    进入首页时,通过最初的调用,进入控制器phpcmsmodulescontentindex.php::init()中

    //首页
    public function init() {
        if(isset($_GET['siteid'])) {
            $siteid = intval($_GET['siteid']);//当前站点id  函数intval作用变量转成整数类型
        } else {
            $siteid = 1;
        }
        $siteid = $GLOBALS['siteid'] = max($siteid,1);
        define('SITEID', $siteid);
        $_userid = $this->_userid;
        $_username = $this->_username;
        $_groupid = $this->_groupid;
        //SEO 搜索引擎优化信息
        $SEO = seo($siteid);//SEO 搜索引擎优化信息
        $sitelist  = getcache('sitelist','commons');//缓存后台设置的所有站点配置信息
        $default_style = $sitelist[$siteid]['default_style'];//当前站点默认模板风格配置
        $CATEGORYS = getcache('category_content_'.$siteid,'commons');//当前站点所有栏目详细配置信息
        include template('content','index',$default_style);//调用第三步:模板调用
    }

    $siteid=1

    $path.$classname=libsclassescache_factory

    public function get()中 

    $filepath = CACHE_PATH.'caches_'.$module.'/caches_'.$type.'/'=C:phpworkangth_comsrccachescaches_commons/caches_data/

    $filename=sitelist.cache.php
     
    $filepath = CACHE_PATH.'caches_'.$module.'/caches_'.$type.'/'=C:phpworkangth_comsrccachescaches_commons/caches_data/
    $filename=category_content_1.cache.php
     
    通过
    $data = @require($filepath.$filename);获取缓存中的数据
    $CATEGORYS = getcache('category_content_'.$siteid,'commons');获取到栏目数据
     
    function template($module = 'content', $template = 'index', $style = 'default')中
    $compiledtplfile = PHPCMS_PATH.'caches'.DIRECTORY_SEPARATOR.'caches_template'.DIRECTORY_SEPARATOR.$style.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.$template.'.php'
    =C:phpworkangth_comsrccachescaches_templatedefaultcontentindex.php
     
    PC_PATH.'templates'.DIRECTORY_SEPARATOR.$style.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.$template.'.html'
    =C:phpworkangth_comsrcphpcms	emplatesdefaultcontentindex.html
     
    public function template_compile('content', 'index', $style = 'default')完成根据模板编译成php文件的过程
    $tplfile=C:phpworkangth_comsrcphpcms	emplatesdefaultcontentindex.html
     
    NB的是通过
    public function template_parse($str)
    将html模板文件转化为php文件
     
    转化完成后通过之前
    public function init()函数中最后一行:include调用生成的cachescaches_templatedefaultcontentindex.php
     
     
  • 相关阅读:
    luogu P1833 樱花 看成混合背包
    luogu P1077 摆花 基础记数dp
    luogu P1095 守望者的逃离 经典dp
    Even Subset Sum Problem CodeForces
    Maximum White Subtree CodeForces
    Sleeping Schedule CodeForces
    Bombs CodeForces
    病毒侵袭持续中 HDU
    病毒侵袭 HDU
    Educational Codeforces Round 35 (Rated for Div. 2)
  • 原文地址:https://www.cnblogs.com/luhouxiang/p/5622984.html
Copyright © 2011-2022 走看看