zblog调用某个指定分类的最新、热门、热评文章

8976988822周前 (01-08)zblog3

来源:天兴工作室

1、在include.php中添加,注意修改主题id

function 主题ID_GetArticleCategorys($Rows,$CategoryID,$hassubcate){    global $zbp;    $ids = strpos($CategoryID,',') !== false ? explode(',',$CategoryID) : array($CategoryID);    $wherearray=array();     foreach ($ids as $cateid){      if (!$hassubcate) {        $wherearray[]=array('log_CateID',$cateid);       }else{        $wherearray[] = array('log_CateID', $cateid);        foreach ($zbp->categorys[$cateid]->SubCategorys as $subcate) {          $wherearray[] = array('log_CateID', $subcate->ID);        }      }    }    $where=array(       array('array',$wherearray),       array('=','log_Status','0'),     );     $order = array('log_PostTime'=>'DESC'); //可以修改按时间、浏览量、评论数排序    $articles=    $zbp->GetArticleList(array('*'),$where,$order,array($Rows),'');         return $articles;}

2、前台调用:

{foreach $array=主题ID_GetArticleCategorys(10,'1,2,3',true)  as $related}    <li><a href="{$related.Url}" target="_blank">{$related.Title}</a></li>{/foreach}

3、判断按发布时间排序、浏览数、评论数排序

log_PostTime=按照时间排序;log_CommNums=按照评论数量排序;log_ViewNums=按照浏览数量排序;


扫描二维码推送至手机访问。

版权声明:本文由米表程序发布,如需转载请注明出处。

本文链接:https://www.9909999.xyz/post/150.html

分享给朋友: