使用相对路径从子文件夹中包含Smarty模板

时间:2011-10-02 04:32:33

标签: smarty

我为智能模板创建了一个文件夹结构

f 
.f1 
..template1.tpl 
..test.tpl 
template1.tpl 

template_dir路径指向文件夹'f /'

test.tpl中的

是下面的代码

{include file="template1.tpl"} 
{include file="../template1.tpl"} 

此代码不起作用。知道我可能会出错吗?

我读到了关于$ smarty-> use_sub_dirs = true,它在我的template_c文件夹中创建了子文件夹,但我仍然无法按照上面的代码包含模板。

提前致谢。

1 个答案:

答案 0 :(得分:4)

只需将f1添加到您的网址

即可

{include file =“f1 / template1.tpl”}

相关问题