开发者

Dwoo template search path

can I somehow add paths where Dwoo is looking for templates from? I have two folders where I store my templates, and I would like to use extends-function across these two directories without having to do stuff like 开发者_如何转开发"../templates/template.tpl" or using absolute paths.

So, if I do this in my template

{extends "base.htm"}

I'd like Dwoo to look, for example, directories "/www/site/templates" and "/www/site/static" for this file.


You can use the includePaths function of the Dwoo_Template_File class, for example:

$tpl = new Dwoo_Template_File('foo.html');
$tpl->setIncludePath(array('/www/site/templates', '/www/site/static'));
echo $dwoo->get($tpl, $data);

Then it should automatically look up relative paths from all those dirs and take the first that is found.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜