0
從我的理解中,Smarty包含了許多與PHP等價的內置函數。如何將此Smarty代碼轉換回PHP?
如何將下面的代碼轉換回原生PHP? 「部分」與for循環相似嗎?
<table width="400" border="0">
{section name=x loop=$records}
<tr>
{section name=y loop=$records[x]}
<td align="right">
<input type="checkbox" name="{$records[x][y].prefkey}" {if $records[x][y].prefval eq "on"}checked{/if} />
</td>
<td align="left">
<strong> {$records[x][y].prefkey}</strong>
</td>
{/section}
</tr>
{/section}
</table>
根據文檔,{section}適用於順序數組,而不適用於關聯數組。 http://www.smarty.net/docsv2/en/language.function.section.tpl – 2011-05-18 18:18:35
所以這仍然有效? – 2011-05-18 18:22:50
@AJ你說得對。謝謝。根據文檔,@Trenton Scott,這是行不通的 – Damp 2011-05-18 18:56:04