phpcms源码跟踪(1)
2016-06-28 12:14
543 查看
本次跟踪解决几个问题:
1、缓存文件从哪里来,过程中被删除了怎么办
2、模板html是如何被引入的
进入首页时,通过最初的调用,进入控制器\phpcms\modules\content\index.php::init()中
$siteid=1
$path.$classname=libs\classescache_factory
$filepath=CACHE_PATH.'caches_'.$module.'/caches_'.$type.'/'=C:\phpwork\bangth_com\src\caches\caches_commons/caches_data/
1、缓存文件从哪里来,过程中被删除了怎么办
2、模板html是如何被引入的
进入首页时,通过最初的调用,进入控制器\phpcms\modules\content\index.php::init()中
[code]//首页
publicfunctioninit(){
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');//当前站点所有栏目详细配置信息
includetemplate('content','index',$default_style);//调用第三步:模板调用
}
$siteid=1
$path.$classname=libs\classescache_factory
publicfunctionget()中
$filepath=CACHE_PATH.'caches_'.$module.'/caches_'.$type.'/'=C:\phpwork\bangth_com\src\caches\caches_commons/caches_data/
$filename=sitelist.cache.php
$filepath=CACHE_PATH.'caches_'.$module.'/caches_'.$type.'/'=C:\phpwork\bangth_com\src\caches\caches_commons/caches_data/
$filename=category_content_1.cache.php
通过
$data=@require($filepath.$filename);获取缓存中的数据
即
$CATEGORYS=getcache('category_content_'.$siteid,'commons');获取到栏目数据
functiontemplate($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:\phpwork\bangth_com\src\caches\caches_template\default\content\index.php
PC_PATH.'templates'.DIRECTORY_SEPARATOR.$style.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.$template.'.html'
=C:\phpwork\bangth_com\src\phpcms\templates\default\content\index.html
publicfunctiontemplate_compile('content','index',$style='default')完成根据模板编译成php文件的过程
$tplfile=C:\phpwork\bangth_com\src\phpcms\templates\default\content\index.html
NB的是通过
publicfunctiontemplate_parse($str)
将html模板文件转化为php文件
转化完成后通过之前
publicfunctioninit()函数中最后一行:include调用生成的\caches\caches_template\default\content\index.php
相关文章推荐
- SMTP 发送邮件 字符串拼接
- PHP实现自己的验证码(实例)
- php表单提交
- PHP中的魔术方法总结 :__construct, __destruct , __call, __callStatic,__get, __set, __isset, __unset , __sleep, __wakeup, __toStr
- php设计模式-观察者模式
- Windows下用IIS搭建ftp服务器不能使用详解
- php 读取表结构自动生成php操作类
- Yii登录验证和全局访问用户ID
- TP框架验证码及文件上传
- 远程服务器的环境的配置
- PHP语言开发Paypal支付demo的具体实现
- PHPunit用法和xml文件
- php中namespace和use的用法
- PHP函数篇之掌握ord()与chr()函数应用
- php 导入excel 方法
- thinkphp not found 不能使用urlrewrite
- 【转】phpcms 手机版本m. 电脑版www. 双模板操作
- vsftpd安装遇到问题
- php fsockopen多线程实现
- php模式-数据映射模式