Welcome to Love Source Demo Station

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

Channel: media coverage Date: Browse: 427

On the zblog forum, I saw a user asking how to count zblog The number of updates in 24 hours. If there is no misunderstanding, the user should want to get the number of articles published by the zblog website in 24 hours. In fact, it can be achieved through a few basic SQL queries, but zblog PHP is evil. The database is queried through linked SQL. I'm not used to it all the time, so I directly use the Z-wiki example to change it to count the number of 24-hour updates to zblog.

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

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!

zero Leaving a message.

comment

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