require_once '../admin/conn.php';
require_once '../admin/function.php';
$dbconn=new dbconn();
$dbconn->geconn();
$typeid = intval($_GET['id']);
$n = intval($_GET['n']);
$page_size = 6;
$all_page = 0;
//文章分类
$sql = "select * from arc_type where id = $typeid";
$rs = mysql_query($sql);
$arc_type = mysql_fetch_array($rs);
if(0 == $arc_type['pid'])
{
$arc_top_type = $arc_type;
}
else
{
//文章顶级分类
$sql = "select * from arc_type where id = {$arc_type['pid']}";
$rs = mysql_query($sql);
$arc_top_type = mysql_fetch_array($rs);
}
//主分类下子类ID
$sql = "select * from arc_type where pid = {$arc_top_type['id']}";
$rs = mysql_query($sql);
$typeids = $arc_top_type['id'];
while($row = mysql_fetch_array($rs))
{
$typeids .= ",{$row['id']}";
$arc_types[] = $row;
}
//手动分页
if($arc_top_type == $arc_type)//顶级列表
{
$sql = "select id,file_name,description,content,send_time,title from article where typeid in ($typeids) ";
//分页总记录数
$count_sql = "select count(id) count ".stristr($sql,'from');
$rs = mysql_query($count_sql);
$row = mysql_fetch_array($rs);
$count = $row['count'];
$all_page = floor(($count-1)/$page_size) + 1 ;
//分页sql
$sql .= " limit ".($n*$page_size).",$page_size ";
$rs = mysql_query($sql);
while($row = mysql_fetch_array($rs))
{
$list[] = $row;
}
}
else //二级列表
{
$sql = "select id,file_name,description,content,send_time,title from article where typeid = $typeid ";
//分页总记录数
$count_sql = "select count(id) count ".stristr($sql,'from');
$rs = mysql_query($count_sql);
$row = mysql_fetch_array($rs);
$count = $row['count'];
$all_page = floor(($count-1)/$page_size) + 1 ;
//分页sql
$sql .= " limit ".($n*$page_size).",$page_size ";
$rs = mysql_query($sql);
while($row = mysql_fetch_array($rs))
{
$list[] = $row;
}
}
可以根据,文章分类生成 文章 HTML 代码,只限2级分类。
- 上一篇:网页编码统一的必要性
- 下一篇:织梦系统配置长度限制修改-DEDECMS 建站