📄 productdisplay.php
字号:
<?php
/**********************************************
productdisplay.php - 商品列表
Version : 1.2
Author : Tracemouse (tracemouse@msn.com)
Copyright:
Writed : 2003/08/09
Modified : 2004/04/10
**********************************************/
require "./include/base.php";
if(!isset($sortid)) showmessage('Loading...','misc.php?action=allp');
else $sortid=intval($sortid);
$sql_and=" AND ";
$sql_or=" OR ";
//$perpage=2; //每页显示的记录数
$NOIMG=IMGDIR."/noimg.gif";
//$sqlstr="select a.sortid,a.sortname,a.class,a.supsortid,a.largesortid,b.sortname as supsortname,c.sortname as largesortname
// from $table_sorts a,$table_sorts b,$table_sorts c where a.sortid=$sortid and a.supsortid=b.sortid and a.largesortid=c.sortid";
$sqlstr="select * from $table_sorts where sortid=$sortid";
$query=$db->query($sqlstr,1);
if($sort=$db->fetch_array($query))
{
if($sort['class'] == 'group')
{
showmessage('Loading...','catalog.php?sortid=$sortid');
exit;
}
elseif($sort['class']=='sort')
{
$sort[sortid]=$sort[sortid];
$sort[sort]=$sort[sortname];
$sqlstr="select * from $table_sorts where sortid=$sort[supsortid]";
$query=$db->query($sqlstr,1);
$dbq_rec=$db->fetch_array($query);
$sort[group]=$dbq_rec[sortname];
$sort[groupid]=$dbq_rec[sortid];
$sqlstr="select * from $table_sorts where supsortid=$sortid order by sortid";
$query=$db->query($sqlstr,1);
$sortcondition="sortid in (".$sortid;
while($dbq_rec=$db->fetch_array($query))
{
$sortcondition.=",".$dbq_rec[sortid];
}
$sortcondition.=")";
}
elseif($sort['class']=='sub')
{
$sortcondition="sortid=$sortid";
$sort[subid]=$sort[sortid];
$sort[sub]=$sort[sortname];
$sqlstr="select * from $table_sorts where sortid=$sort[supsortid]";
$query=$db->query($sqlstr,1);
$dbq_rec=$db->fetch_array($query);
$sort[sortid]=$dbq_rec[sortid];
$sort[sort]=$dbq_rec[sortname];
$sqlstr="select * from $table_sorts where sortid=$dbq_rec[supsortid]";
$query=$db->query($sqlstr,1);
$dbq_rec=$db->fetch_array($query);
$sort[groupid]=$dbq_rec[sortid];
$sort[group]=$dbq_rec[sortname];
}
}
$nav .= SEPARATER."<a href='catalog.php?sortid=$sort[groupid]'>".$sort[group]."</a>";
$nav .= SEPARATER."<a href='productdisplay.php?sortid=$sort[sortid]'>".$sort[sort]."</a>";
if($sort['class'] == 'sub')
{
$nav .= SEPARATER."<a href='productdisplay.php?sortid=$sort[subid]'>".$sort[sub]."</a>";
}
$query=$db->query("select count(*) from $table_sorts where supsortid=$sortid");
$subsortnum=$db->result($query,0);
$query=$db->query("select * from $table_sorts where supsortid=$sortid");
$subsortlist=array();
while($dbq_rec=$db->fetch_array($query))
{
$subsortlist[]=$dbq_rec;
}
$condition=" where $sortcondition ";
if (empty($orderindex))
$condition .= "order by posttime DESC";
else
{
if($orderway == 'up')
$condition .= "order by $orderindex";
else
$condition .= "order by $orderindex DESC";
}
$query = $db->query("select count(*) from $table_products $condition");
$productnum=$db->result($query,0);
$count=$productnum;
if ($count <= $perpage)
{
$maxpage=1;
}
else
{
$maxpage=($count - ($count % $perpage))/$perpage;
$maxpage=$maxpage+1;
}
if(!empty($page))
{
$start_limit=($page-1) * $perpage;
$startnum = ($page-1) * $perpage + 1;
$endnum = $page * $perpage;
}
else
{
$startnum = 1;
$endnum = $perpage;
$start_limit=0;
$page = 1;
}
$multipage = multi($count, $perpage, $page, "productdisplay.php?sortid=$sortid&orderindex=$orderindex&orderway=$orderway&hideimg=$hideimg");
$productlist = array();
$query = $db->query("select * from $table_products $condition limit $start_limit,$perpage");
while($dbq_rec = $db->fetch_array($query))
{
$dbq_rec['img']=empty($dbq_rec['smallimg'])?IMGDIR."/noimg.gif":$dbq_rec['smallimg'];
$dbq_rec['subject'] = substr($dbq_rec['notes'],0,101)."...";
$productlist[] = $dbq_rec;
}
include template('productdisplay');
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -