Php Smarty-从TPL导出txt文件

Php Smarty-从TPL导出txt文件,php,smarty,Php,Smarty,我基本上有这样的代码: <table width="100%" border="1" cellspacing="0" cellpadding="0"> <tr> <td>{$root.page.contentgroup.Directory[0]}</td> <td>{$root.page.contentgroup.Title[0]}</td> <td>{$root.page.contentgroup.Descri

我基本上有这样的代码:

<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>{$root.page.contentgroup.Directory[0]}</td>
<td>{$root.page.contentgroup.Title[0]}</td>
<td>{$root.page.contentgroup.Description[0]}</td>
</tr>
</table>
更好的方法是什么?我只能使用smarty函数


谢谢

这必须用php实现。Smarty是一个模板引擎,只能用于演示。或者更好——我的观点——根本不要使用模板引擎。基于此的观点问题

如果您非常想做一些非常糟糕的事情,可以使用{php}标记,该标记允许将php代码嵌入smarty的.tpl文件中


你应该用PHP而不是Smarty来做
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>mydirectory</td> {**directory.txt**}
<td>mytitle</td> {**title.txt**}
<td>mydescription</td> {**description.txt**}
</tr> 
</table>
[SUBMIT]
mysite/folder/{$root.page.contentgroup.Directory[0]}/directory.txt
mysite/folder/{$root.page.contentgroup.Directory[0]}/title.txt
mysite/folder/{$root.page.contentgroup.Directory[0]}/description.txt
{php}
   // including a php script directly from the template.
   include('/path/to/your_file_generation_script.php');
{/php}