欢迎访问 舍力博客(www.shuyong.net)
function slsort($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;}调用代码:
{php}$flids = explode(',','1,2');{/php} {foreach $flids as $flid} {if isset($categorys[$flid])} <a href="{$categorys[$flid].Url}" title="{$categorys[$flid].Name}">{$categorys[$flid].Name}</a> {/if} {foreach $array=slsort(8,$flid,true) as $related} <a href="{$related.Url}" title="{$related.Title}">{strip_tags($related.Title)}</a></p> {/foreach} {/foreach}其中的1,2为分类id,可使用后面主题设置参数$zbp->Config('qyblue')->cpid;8为显示的数量
留言/评论:◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。