在Smarty.class.PHP中,方法Smarty :: _ parse_resource_name():
foreach ((array)$params['resource_base_path'] as $_curr_path) {
$_fullpath = $_curr_path . DIRECTORY_SEPARATOR . $params['resource_name'];
if (file_exists($_fullpath) && is_file($_fullpath)) {
$params['resource_name'] = $_fullpath;
return true;
}
// didn't find the file,try include_path
$_params = array('file_path' => $_fullpath);
require_once(SMARTY_CORE_DIR . 'core.get_include_path.PHP');
if(smarty_core_get_include_path($_params,$this)) {
$params['resource_name'] = $_params['new_file_path'];
return true;
}
}
$params [‘resource_base_path’]默认为Smarty :: _ fetch_resource_info()中的$this-> template_dir.
因此,您可以将$smarty-> template_dir设置为要查看的目录数组.请注意,这不会是递归的.这必须是未记录的功能.