【问题标题】:Including Smarty templates from sub-folders using relative paths使用相对路径包含来自子文件夹的 Smarty 模板
【发布时间】:2011-10-02 04:32:33
【问题描述】:

我已经为 smarty 模板创建了一个文件夹结构

F .f1 ..template1.tpl ..test.tpl 模板1.tpl

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

在test.tpl中是下面的代码

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

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

我阅读了有关 $smarty-> use_sub_dirs = true 的信息,它确实在我的 template_c 文件夹中创建了子文件夹,但我仍然无法按照上述代码包含模板。

提前致谢。

【问题讨论】:

  • 我自己解决了这个问题。这个想法是做一个 {include file="f1/template1.tpl"} {include file="template1.tpl"}

标签: smarty


【解决方案1】:

只需将 f1 添加到您的 URL

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-08
    • 1970-01-01
    • 2011-12-08
    • 1970-01-01
    相关资源
    最近更新 更多