本文整理匯總了PHP中Smarty_Internal_Template::loadSource方法的典型用法代碼示例。如果您正苦於以下問題:PHP Smarty_Internal_Template::loadSource方法的具體用法?PHP Smarty_Internal_Template::loadSource怎麽用?PHP Smarty_Internal_Template::loadSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Smarty_Internal_Template
的用法示例。
在下文中一共展示了Smarty_Internal_Template::loadSource方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: load
/**
* get a Compiled Object of this source
* @param Smarty_Internal_Template $_template template object
* @return Smarty_Template_Compiled compiled object
*/
static function load($_template)
{
if (!isset($_template->source)) {
$_template->loadSource();
}
// check runtime cache
if (!$_template->source->recompiled && $_template->smarty->resource_caching) {
$_cache_key = $_template->source->unique_resource . '#';
if ($_template->caching) {
$_cache_key .= 'caching#';
}
$_cache_key .= $_template->compile_id;
if (isset($_template->source->compileds[$_cache_key])) {
return $_template->source->compileds[$_cache_key];
}
}
$compiled = new Smarty_Template_Compiled();
if (method_exists($_template->source->handler, 'populateCompiledFilepath')) {
$_template->source->handler->populateCompiledFilepath($compiled, $_template);
} else {
$compiled->populateCompiledFilepath($_template);
}
// runtime cache
if (!$_template->source->recompiled && $_template->smarty->resource_caching) {
$_template->source->compileds[$_cache_key] = $compiled;
}
return $compiled;
}
示例2: __construct
/**
* create Cached Object container
*
* @param Smarty_Internal_Template $_template template object
*/
public function __construct(Smarty_Internal_Template $_template)
{
$this->compile_id = $_template->compile_id;
$this->cache_id = $_template->cache_id;
if (!isset($_template->source)) {
$_template->loadSource();
}
$this->source = $_template->source;
if (!class_exists('Smarty_CacheResource', false)) {
require SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php';
}
$this->handler = Smarty_CacheResource::load($_template->smarty);
}