本帖最后由 iaipanda 于 2014-3-21 16:15 编辑
门户首页如何实现分页,类似这个网站的http://www.xda.cn/
- //portal_article_content 门户文章内容表
- //portal_article_title 门户文章标题表
- //pre_portal_category 门户 文章栏目表
- $aids='1,2,3';//调用的文章栏目,多个用半角逗号分开
- $order='dateline';//排序方式,dateline是时间,
- $summarylength=300';//摘要内容字数
- $num=2;
- $begin=($_G['page']-1)*$num;
- $manylist=array();
- $rs=DB::query("
- SELECT a.*,c.*
- from ".DB::table("portal_article_title")." a
- LEFT JOIN ".DB::table("portal_category" )." c on c.catid = a.catid
- Where a.`aid` in($aids)
- group by a.aid
- ORDER BY a.`$order` DESC
- LIMIT $begin , $num");
复制代码- while ($row=DB::fetch($rs)) {
- $row['summary']=messagecutstr($rw['summary'],$summarylength,'');
- $row['summary']=dhtmlspecialchars($row['summary']);
- $manylist[]=$row;
- }
- $allnum=DB::result_first("select count(*) from ".DB::table("portal_article_title")." where aid in ($aids)");
- $pages=multi($allnum,$num,$_G['page'],"portal.php?");
复制代码 在门户的index.htm里加载上面的文件
- <!--{eval require("template/yeei_dream1/portal/article.php");}-->
- <!--{loop $manylist $art}-->
复制代码
|