php smarty循环行和列
php教程 smarty循环行和列
html例子
<div id="result"> <!--圆角边框--> <div style="width:750px; float:right;"> <div style="height:1px; margin:0 3px; background:#FF9900; overflow:hidden; font- size:0px;"></div> <div style="height:1px; margin:0 1px; background:#FF9900; overflow:hidden; font- size:0px; border-Left:2px solid #FF9900;border-Right:2px solid #FF9900;"></div> <div style=" height:1px; margin:0 1px; background:#FF9900; overflow:hidden; font -size:0px; border-Left:2px solid #FF9900;border-Right:2px solid #FF9900; padding -bottom:0;"></div> <!--圆角边框结束--> <table width="750" style="border:1px solid #ff9900;" align="center" cellspacing="0" cellpadding="0"> <tr> <td height="20" align="left" valign="middle" bgcolor="#ff9900" style="color:#FFFFFF; font-weight:bold; padding-left:20px; font-size:14px;" colspan="3"><a href="#" class="hot">最新商品</a></td> </tr> <tr> {foreach key=key item=item from=$newarr} {if $key == 3}<tr>{/if} <td height="210" align="center" valign="middle"> <table width="210" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="210" colspan="2" align="center" valign="middle"><img src="{$item.pics}" width="210" height="180" style="border: 1px solid #cccccc; padding:0 10px;" onClick="openshowcommo({$item.id})"/></td> </tr> <tr class="mv"> <td height="17" align="center" valign="middle">市场价:<font color="#FF6600"><b>{$item.m_price}</b>¥</font></td> <td height="17" align="center" valign="middle"><font color="#FF6600"><b>会员价:{$item.v_price}</b>¥</font></td> </tr> <tr> <td height="15" align="center" valign="middle"><img src="images/777.png" alt="消费者保障服务,买家承诺7天无理由退换货" width="22" height="20"><img src="images/z.png" alt="消费者保障服务,买家承诺商品如实描述" width="20" height="21"><img src="images/k.png" alt="该商品支持信用卡支付" width="24" height="16"></td> <td height="15" align="center" valign="middle"><a href=tencent://message/?uin=718845039&Site=www.cnclcy&Menu=yes><img border="0" alt="点击这里给我发消息" src="images/qq.png" width="72" height="25"></a></td> </tr> </table> </td> {/foreach} </tr> <tr> <td align="center" colspan="3">{$string}</td> </tr> </table> </div> </div> php代码 <?php include_once 'conn/conn1.php'; include_once 'config.php'; $page1 = isset($_GET['page1']) ? $_GET['page1'] : 1; $shownum = 6; $start = $shownum * ($page1 - 1); $arr = selectArr("*","tb_commo","where isnew = 1 order by isnew,id desc limit $start,$shownum"); $num = number("*","tb_commo","where isnew = 1 order by isnew,id desc"); if($num == 0) { echo "在无记录!"; } else { $pagenum = ceil($num / $shownum); $string = ""; for($i = 1; $i <= $pagenum; $i++) { $string .= ($i == $page1) ? "<input type='buttom' style='border:1px solid #ff6600;text-align:center;width:18px; height:18px;background:#ffffcc;color:#ff6600;' value='$i'>"." " : "<a onclick=网页特效:result('allnew.php?page1=$i')><b>"."<input type='buttom' style='border:1px solid #669900;text-align:center;width:18px; height:18px;cursor:pointer' value='$i'>"." </b></a>"; } } $smarty->assign('newarr',$arr); $smarty->assign('string',$string); $smarty->assign('title','最新商品'); $smarty->display('allnew.html');
本文地址:http://www.phprm.com/frame/38811.html
转载随意,但请附上文章地址:-)