Provide zblog template_zblog them_wordpress template download and customization

Zblogphp obtains articles of multiple categories and sorts them according to the specified requirements (the latest hot reviews)

Tianxing Studio 2016-04-18 15:18 Zblogphp Tutorial nine thousand one hundred and forty-three 2 Comments


This article is reproduced from the Bird Blog. The original address is: http://www.birdol.com/zblogjiaocheng/792.html

Because this method is too easy to use, and the bird's writing is too simple... So I reorganized and distributed them, hoping to help friends in need.

The following is an encapsulated function. Copy and paste the code into the include.php of the theme you are using:

 function Nobird_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; }

usage method:

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

instructions:

Use the four Arabic numerals in the first line of code in the method, where 10 represents the number of articles called, and "1, 2, 3" represents the column ID called (multiple IDs can be separated by numbers).

We can also modify the "array ('log_PostTime '=>'DESC');" in the function, where:

Log_PostTime=Sort by time;

Log_CommNums=Sort by the number of comments;

Log_ViewNums=Sort by number of views;

In this way, you can play different tricks according to your own needs!


Can't find a tutorial that can solve your problem?

You can try to search or ask questions directly online. We also provide charging technical support. If you need it, you can contact us online.

Online questions Online Service

yes two Comments from netizens:

  •  dafuli

    dafuli Seven years ago (January 13, 2017) reply

    foreach ($zbp- ˃ categorys[$cateid]- ˃ SubCategories as $subcate)? One of the two stations of the same host is normal and the other is wrong! Normal station: system environment Linux; Apache; PHP 5.6.29 x64; mysqli; Curl error reporting station: system environment Linux; Apache; PHP 5.6.29 x64; pdo_mysql; curl

  •  Drizzle

    Drizzle 8 years ago (2016-04-18) reply

    Thanks for Tianxing's further detailed introduction. I can't use what Brother Bird wrote. All the tutorials you introduced are easy for us novices to learn!

welcome you Comment: Cancel Reply

 Please fill in the verification code
  • Latest articles
  • Hot article ranking
  • Most Comments
Label aggregation
  • Sign in
  • Registered account Forgot your password?
  • register
  • Already have an account? Direct login Forgot your password?
  • Social account login