我正在制作一个 PHP wiki 引擎,它对指向它的所有网站都使用相同的模板。但是,有些网站有自定义模板。如果它存在,我可以让 Smarty 使用这个自定义模板吗?
这是我的目录结构:
/web/wiki/templates <-- all templates here
/web/wiki/templates/wiki.domain.com <-- individual template
我怎样才能使 smarty 在/web/wiki/templates/wiki.domain.com
第一个 for中使用模板wiki.domain.com
,如果此目录中不存在该模板,则在 中使用该模板/web/wiki/templates
?
我可以为 Smarty 定义多个模板目录,并让它首先尝试从顶层目录中选择模板吗?如果我能做到这一点,我可以简单地改变模板目录的顺序:
/web/wiki/templates/wiki.domain.com
/web/wiki/templates