Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以以某种方式添加 Dwoo 从中寻找模板的路径吗?我有两个文件夹来存储我的模板,我想在这两个目录中使用扩展功能,而不必执行“../templates/template.tpl”之类的操作或使用绝对路径。
所以,如果我在我的模板中这样做
{extends "base.htm"}
例如,我希望 Dwoo 查看此文件的目录“/www/site/templates”和“/www/site/static”。
您可以使用 Dwoo_Template_File 类的 includePaths 函数,例如:
$tpl = new Dwoo_Template_File('foo.html'); $tpl->setIncludePath(array('/www/site/templates', '/www/site/static')); echo $dwoo->get($tpl, $data);
然后它应该自动从所有这些目录中查找相对路径并获取找到的第一个。