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>&nbsp;&nbsp;<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,显示的效果如下:

解决方案 »

  1.   

    type.html 你显示的是 html
    你应该显示的时 渲染此html的方法。
      

  2.   

    您能告诉使用什么方法渲染此html吗?
      

  3.   

    你那个方法对 这个html 进行解释的,你就调用那个方法,不是调用这个html,明不???
      

  4.   

    我只知道你渲染的是index.html页面,替换的变量只显示在这个页面,无法解释type.html 里面的变量
    我也想知道除了写$smarty->display("index.html");解释一个页面外。能否有解释多个页面的方法,这样相同的类容就不用再重复写
      

  5.   

    你要寫display("type.html"); //這樣他就不會把你代碼輸出來了...
    在display("index.html")------------------------------------
    或者你一次將所有的變量都設置好.
    在display之後 type.html中的代碼頁可以解釋的.
      

  6.   

    您们讲解的我都不怎么明白,我想问的是:在display("index.html")时,能将index.html页面中iframe包含的页面type.html也能解释smarty格式
      

  7.   

    受你们点拨,我想到了解决的方法:iframe对应 一个php文件,这个php文件通过smarty去调用对应的html。问题解决了,谢谢你们!