打印 smarty 文件内容
我包括这样的模板:
<div id="comments" >
{include file='comm/comm_all.tpl'}
</div>
并且我想将 comm_all.tpl 内容回显到 html。 像这样的事情:
<div id="comments" >
{include file='comm/comm_all.tpl'}
</div>
<div id="code_preview" >
the code previw is:
{include_function file='comm/comm_all.tpl'}
</div>
包含函数就是我正在寻找的,它
应该获取文件内容并“按原样”打印 例如:
<div id="comments" >
1. bla bla the show
2. it`s an array as you guess.
</div>
<div id="code_preview" >
the code previw is:
{foreach $array as $i => $v}
$i. {$v.content}
{/foreach}
</div>
i am including template like this:
<div id="comments" >
{include file='comm/comm_all.tpl'}
</div>
and i would like to echo the comm_all.tpl contents to the html.
somthing like that:
<div id="comments" >
{include file='comm/comm_all.tpl'}
</div>
<div id="code_preview" >
the code previw is:
{include_function file='comm/comm_all.tpl'}
</div>
the include function is what i looking for, and it
should take the file content and print "as it is"
for example:
<div id="comments" >
1. bla bla the show
2. it`s an array as you guess.
</div>
<div id="code_preview" >
the code previw is:
{foreach $array as $i => $v}
$i. {$v.content}
{/foreach}
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解正确的话,你想要做的不是在 Smarty 中,而是可以通过 PHP 中的插件函数来完成。
If I understand you correctly, what you want to do is not within Smarty, but could be done with a plugin function in PHP.