Zblog Statistics website published in the last 24 hours of the code number of articles

Exhibition of works zero two hundred and three

If the website is updated frequently and has a lot of updated content, the website's statistical data, such as the total number of articles and the total number of views, will be displayed on the front page of zblog website. In addition, the statistics of the number of articles updated in the last 24 hours are often seen. How can the data of the number of published articles in zblog be called? Only two pieces of code are required.

 Zblog Statistics website published in the last 24 hours of the code number of articles

Put the following code into the theme's include.php file:

PHP
 function qiteen_ postNum(){ global $zbp; $nowtime = time(); $settime = 1*24*60*60; $gettime = $nowtime-$settime; $db = $zbp->db->sql->get(); $sql = $db->select('zbp_post')->where(array(array('=','log_Status','0'),array('>','log_PostTime',$gettime)))->sql;     $array = $zbp->GetListType('Post', $sql); echo count($array);    }

Add code where you want to call it, such as the foot.php file:

PHP
 {qiteen_postNum()}

Save the file, update the cache in the background or recompile the theme.

Note: the above code only applies to zblog PHP version 1.5 or above.

Related recommendations:

Comments from netizens:

I would like to comment:

Welcome to participate in the discussion. Please express your views and exchange your views here.
 Verification Code