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

Channel: Technical Tutorial Date: Browse: 1506

On the zblog forum, I saw a user asking how to count the number of updates to zblog in 24 hours. If there is no misunderstanding, the user should want to get the number of articles published by zblog website in 24 hours. In fact, it can be achieved through a few basic SQL queries. However, zblog php is evil. I have never been used to querying databases through chained SQL, so I directly changed the Z-wiki example to calculate the 24-hour update quantity of zblog.

be careful: The following code is only applicable to zblog php 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 a call code where you want to call to display the number of updates:

 {boke8_postNum()}

Function realization!