PHP代码
<?php 
include_once("../Mconfig/conndb.inc.php");
include_once("../Mconfig/templateConfig.inc.php");
//$rs = $db->SelectLimit($sqlrs,5,0);
$template= new SmartTemplate('main.html');
//本月价格升幅排行榜
$rs=$conn->execute("SET @rownum =0");
$rs=$conn->execute("SELECT @rownum := @rownum +1 AS rownum,a.news_id,a.news_puid,a.news_name,a.news_alias,a.news_specification,b.type_name, IFNULL(c.news_price,0) as news_price,ifnull(c.news_proportion ,1) as news_proportion from product_varietytable as a left join product_species as b on a.news_puid=b.type_id left join (SELECT news_id,news_price,news_proportion FROM product_avgtable ORDER BY news_date desc LIMIT 1 ) as c on a.news_id=c.news_id ORDER BY IFNULL(c.news_proportion,0) DESC LIMIT 0 , 12");
$rs=($rs->GetRows()); 
$template->assign('product_avgtable',$rs);
$conn->Close();
$template->output(); 
?>
模板代码
<table width="100%" border="0" cellspacing="1" cellpadding="1">
  <!-- BEGIN product_avgtable -->
  <tr> 
    <td width="773"><a href="Read.php?news_id={news_id}&pid={pid}" class="b">{news_name}</a></div></td>//这行想横向显示(每行显示5条记录后自动换行)
  </tr>
  <!-- END product_avgtable -->
</table>
我现在想要横向显示内容,每行显示5条记录后自动换行。...本人刚学SmartTemplate模板。
那位大侠帮忙。谢谢。

解决方案 »

  1.   

    在网页目录下找到TEMPLES文件夹,然后看下DISPLAY函数显示的网页是哪个(一般是XXX.HTML) 然后找到哪个HTML,改一下表格的格式应该就可以了
      

  2.   

    晕,看下DISPLAY函数显示的网页是哪个???????不明白。
      

  3.   

    现在很少有人在用 SmartTemplate 了
    映像中应使用嵌套的块来实现
    <table width="100%" border="0" cellspacing="1" cellpadding="1">
      <!-- BEGIN product_avgtable -->
      <tr>  
      <!-- BEGIN product_cell -->
      <td width="773"><a href="Read.php?news_id={news_id}&pid={pid}" class="b">{news_name}</a></div></td>//这行想横向显示(每行显示5条记录后自动换行)
      <!-- END product_cell -->
      </tr>
      <!-- END product_avgtable -->
    </table>
      

  4.   

    大侠,请问为什么不用SmartTemplate?
      

  5.   

    晕,
    例如:
    A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P........
    现在我想每行显示5条后就换到下行一直往下。
    A,B,C,D,E
    F,G,H,I,J
    K,L,M,N,O
    。。
      

  6.   

    切割数组 array_chunk目前,人们都追崇编译型模板引擎
    而 SmartTemplate 是解释型模板引擎
    注意,他不是 Smart