The flower fades and the red and green apricots are small. When swallows fly, green water surrounds others.

ZBLOG PHP version obtains articles of multiple categories

ZBLOG Tutorial Birds on the 15th floor 45492 Browse 0 Comments

It would have been much easier in the previous 1.8, but now ZBLOG Encapsulates database statements, which will lead to the disdain of directly using SQL for query...

I wrote an article the other day【 ZBLOG PHP version obtains article list implementation or (OR) query 】However, some people said they didn't understand it, so it was convenient to write an example theme Author.

No nonsense, code directly:

  
if($category->RootID=='0'){
    $tempcid=$category->ID;
    $where =array(array('=','cate_RootID' ,$tempcid));
    $order = array('cate_Order' => 'DESC' );
    $array=$zbp->GetCategoryList(null,$where,$order,null,null);
    $wherearray=array();
    $wherearray[]=array('log_CateID',$tempcid);
    foreach ($array as $cate){
        $wherearray[]=array('log_CateID',$cate->ID);
    }
    $where=array(
                    array('array',$wherearray),
                    array('=','log_Status','0'),
                    );
}else{
    $tempcid=$category->RootID;
    $where =array(array('=','cate_RootID' ,$tempcid));
    $order = array('cate_Order' => 'DESC' );
    $array=$zbp->GetCategoryList(null,$where,$order,null,null);
    $wherearray=array();
    $wherearray[]=array('log_CateID',$category->RootID);
    foreach ($array as $cate){
        $wherearray[]=array('log_CateID',$cate->ID);
    }
    $where=array(
                    array('array',$wherearray),
                    array('=','log_Status','0'),
                    );
 
}
 
//Output popular articles in subcategories
    $num=10;
    $order = array('log_ViewNums'=>'DESC');
  $substr='';
    $arrayhotarticle=    $zbp->GetArticleList(array('*'),$where,$order,array($num),'');
    foreach ($arrayhotarticle as $key=>$b3) {
       $substr.='< li><a href="'.$b3->Url.'"> '.$ b3->Title.' </ a></li>';
    }
echo $substr;

The code may need to be modified slightly. Here is an encapsulated function:

"This part of content can only be viewed after logging in and purchasing this product"!

 

 

merchant
product
purchase
buy

Price: thirty Yuan

Dear, this is an ordinary purchase channel, Buy Now add to cart

Note: This non physical transaction is non refundable after purchase, please consider before purchase| Click here to view the purchase guide

To contact the author, please contact QQ: 8769298 Indicate zblog

 

 

Please specify: Bird Blog » ZBLOG PHP version obtains articles of multiple categories

 tourist
Post my comments Change your identity
Cancel comment

Hi, you need to fill in your nickname and email!

  • Nickname (required)
  • Email (required)
  • website