怎么用smarty包含文件?我使用这个函数:{include file ="modules/news.tpl"}
但显示错误:
警告:Smarty错误:无法读取资源:"modules/news.tpl"
文件存在并位于modules/news.tpl目录中.
谢谢
小智 8
更改
{include file="modules/news.tpl"}
Run Code Online (Sandbox Code Playgroud)
至
{include file="./modules/news.tpl"}
Run Code Online (Sandbox Code Playgroud)
这将至少确定您当前所处的位置.
虽然我不是100%肯定在这里,但我相信Smarty通过查看template_dirconfig变量来解析你的包含.
请参阅doc:http://www.smarty.net/docs/en/variable.template.dir.tpl和http://www.smarty.net/docs/en/language.function.include.tpl.