index.html中有一个iframe,代码如下:
<iframe name="content_iframe" id="content_iframe" width="702" height="385" src="./template/type.html" > </iframe>
type.html中的部分代码如下:
{foreach from=$types item=item name=types}
<tr>
<td width="52">{$smarty.foreach.types.index}</td>
<td width="174">{$item.consume_type_name}</td>
<td width="238"><a href="#">编辑</a> <a href="#">删除</a></td>
</tr>
<tr>
<td colspan="3"><hr /></td>
</tr>
{foreachelse}您还没添加类别!
{/foreach}index.php中的部分代码如下:
dbconnect();
$param['types'] = $_SGLOBAL['db']->fetch_all("select * from consume_type");
template("index.html",$param);我访问http://localhost/hy/index.php,显示的效果如下:
<iframe name="content_iframe" id="content_iframe" width="702" height="385" src="./template/type.html" > </iframe>
type.html中的部分代码如下:
{foreach from=$types item=item name=types}
<tr>
<td width="52">{$smarty.foreach.types.index}</td>
<td width="174">{$item.consume_type_name}</td>
<td width="238"><a href="#">编辑</a> <a href="#">删除</a></td>
</tr>
<tr>
<td colspan="3"><hr /></td>
</tr>
{foreachelse}您还没添加类别!
{/foreach}index.php中的部分代码如下:
dbconnect();
$param['types'] = $_SGLOBAL['db']->fetch_all("select * from consume_type");
template("index.html",$param);我访问http://localhost/hy/index.php,显示的效果如下:
你应该显示的时 渲染此html的方法。
我也想知道除了写$smarty->display("index.html");解释一个页面外。能否有解释多个页面的方法,这样相同的类容就不用再重复写
在display("index.html")------------------------------------
或者你一次將所有的變量都設置好.
在display之後 type.html中的代碼頁可以解釋的.