最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php smarty循环行和列
时间:2011-06-02 编辑:简简单单 来源:一聚教程网
php教程 smarty循环行和列
html例子
cellspacing="0" cellpadding="0">
style="color:#FFFFFF; font-weight:bold; padding-left:20px; font-size:14px;"
colspan="3">最新商品
{foreach key=key item=item from=$newarr}
{if $key == 3}{/if}
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">
{/foreach}
{$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');
?>
-
上一个: php存储例程、存储过程进阶学习
相关文章
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31
- Laravel实现登录跳转功能解析 10-31
- php双向队列解读 10-31
- Laravel异常上下文解决教程 10-24
- php数组查询元素位置方法介绍 10-24