从smarty.class.php文件中的下列代码可以看出来:
/**
* test if resource needs compiling
*
* @param string $resource_name
* @param string $compile_path
* @return boolean
*/
function _is_compiled($resource_name, $compile_path)
{
if (!$this->force_compile && file_exists($compile_path)) {
if (!$this->compile_check) {
// no need to check compiled file
return true;
} else {
// get file source and timestamp
$_params = array('resource_name' => $resource_name, 'get_source'=>false);
if (!$this->_fetch_resource_info($_params)) {
return false;
}
if ($_params['resource_timestamp'] <= filemtime($compile_path)) {
// template not expired, no recompile
return true;
} else {
// compile template
return false;
}
}
} else {
// compiled template does not exist, or forced compile
return false;
}
}
首先会看,是否设置了force_compile,如果为true,那么每次都要进行重新编译。
然后看是否要compile_check,如果为false,那么永远不会进行编译。
如果为true,那么进行检查,检查什么呢?检查文件的修改时间,
如果编译结果的时间>=原模板文件的修改时间,那么不进行重新编译,否则进行编译。
关键在于这个“等号”,我们应该将这个“=”去掉呢?还是他真的有必要?
有事,待续...
分享到:
相关推荐
Smarty PHP Template Programming and Applications 随书代码
Smarty For Template Designers [模板设计者篇] 3. Basic Syntax [基本语法] Comments [注释] Functions [函数] Attributes [属性] Embedding Vars in Double Quotes [双引号里值的嵌入] Math [数学运算] 4....
Smarty Smarty Smarty
Smarty For Template Designers [模板设计者篇] 3. Basic Syntax [基本语法] Comments [注释] Functions [函数] Attributes [属性] Embedding Vars in Double Quotes [双引号里值的嵌入] Math [数学运算] 4....
基本文件文件结构 .../libs/ ...$smarty->display('string:This is my template, {$foo}!'); smarty3的相关链接 Smarty 3 Alpha with SVN-- 选择googlecode提供的svn服务还是蛮省钱的 smarty 3开发者邮件组
2. 编译型:采用Smarty编写的程序在运行时要编译成一个非模板技术的PHP文件,这个文件采用了PHP与HTML混合的方式,在下一次访问模板时将WEB请求直接转换到这个文件中,而不再进行模板重新编译(在源程序没有改动的...
smarty安装及初级使用 在PHP的世界里已经出现了各式各样的模板类,但就功能和速度来说Smarty还是一直处于领先地位,因为Smarty的功能相对强大,所以使用起来比其他一些模板类稍显复杂了一点。现在就用30分钟让您...
Smarty - the compiling PHP template engine的译文版本,高清版。 Smarty 是一个php 模板引擎。更准确的说,它分开了逻辑程序和外在的内容,提供了一种易于管理的方法。
php smarty template 2.6.28
smarty3.0,smarty最新版本
Smarty 模板引擎教程,内容主要有基本语法、变量、组合修改器、内建函数、自定义函数、配置文件、控制台调试、缓存、插件扩展、使用技巧和经验等,比较详细的一个中文手册
Smarty最新版官网,Smarty最新版下载自Smarty官网
php5会使用的smarty运算符,smarty是在php前期使用中常见的模版分离,同时国内鼎鼎大名的ecshop也是采用这样方式开发系统
php模版 (smarty)php模版 (smarty)php模版 (smarty)php模版 (smarty)php模版 (smarty)php模版 (smarty)php模版 (smarty)
smarty 迷你
smarty中section的使用 smarty section php
2015年12月24日最新版:smarty-3.1.29
5分钟搞定smarty5分钟搞定smarty
php Smarty
smarty模板,调用静态页面模板,Smarty-2.6.22