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模板。
那位大侠帮忙。谢谢。
<?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模板。
那位大侠帮忙。谢谢。
映像中应使用嵌套的块来实现
<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>
例如:
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
。。
而 SmartTemplate 是解释型模板引擎
注意,他不是 Smart