addTemplateDir()
向模板存储目录列表中添加一个目录
描述
Smarty
addTemplateDir
string|array
template_dir
string
key
<?php
// 添加存储模板的目录
$smarty->addTemplateDir('./templates_1');
// 添加存储模板的目录并指定数组键
$smarty->addTemplateDir('./templates_1', 'one');
// 添加多个存储模板的目录并指定数组键
$smarty->addTemplateDir(array(
'two' => './templates_2',
'three' => './templates_3',
));
// 查看模板目录链
var_dump($smarty->getTemplateDir());
// 链式调用方法
$smarty->setTemplateDir('./templates')
->addTemplateDir('./templates_1', 'one')
->addTemplateDir('./templates_2', 'two');
?>