How to get the number of articles published by zblog in the past 24 hours

Channel: Technical course Date: View: 303

In the zblog forum, a user is consulting about how to count the number of zblog updates in 24 hours. If there is no misunderstanding, the user should want to get the number of articles published by zblog website within 24 hours. In fact, it can be realized through a few basic SQL queries. However, zblog PHP is more evil. I'm not used to querying the database through linked SQL. So I directly take the example of z-wiki to realize the statistics of the 24-hour update quantity of zblog.

be careful: The following code applies only to zblog PHP version 1.5. X.

1. Add the following code to the theme's include.php file:

 function boke8_ 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);	}

2. Add the calling code where you want to call the display number of updates:


Function realization!