一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

php smarty循环行和列

时间:2011-06-02 编辑:简简单单 来源:一聚教程网

php教程 smarty循环行和列


html例子








cellspacing="0" cellpadding="0">
 


   
 
 
  {foreach key=key item=item from=$newarr}
  {if $key == 3}{/if}
   
   {/foreach}
 
 
     
 

style="color:#FFFFFF; font-weight:bold; padding-left:20px; font-size:14px;"

colspan="3">最新商品


       
       
           
       
       
                    
                  
           
           
                    
                 
           
   

src="{$item.pics}" width="210" height="180" style="border: 1px solid #cccccc;

padding:0 10px;" onClick="openshowcommo({$item.id})"/>

市场价:

color="#FF6600">{$item.m_price}

color="#FF6600">会员价:{$item.v_price}

src="images/777.png" alt="消费者保障服务,买家承诺7天无理由退换货" width="22"

height="20">消费者保障服务,买家承诺商品如实描述

width="20" height="21">该商品支持信用卡支付

width="24" height="16">

href=tencent://message/?uin=718845039&Site=www.cnclcy&Menu=yes>

alt="点击这里给我发消息" src="images/qq.png" width="72" height="25">


  
{$string}



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) ? ""." " : "

onclick=网页特效:result('allnew.php?page1=$i')>"."

style='border:1px solid #669900;text-align:center;

cursor:pointer' value='$i'>"." ";
        }
    }
    $smarty->assign('newarr',$arr);
    $smarty->assign('string',$string);
    $smarty->assign('title','最新商品');
    $smarty->display('allnew.html');
  
?>

热门栏目