当前位置:网站首页>Zblog system realizes the tutorial of the number of articles published on the same day when the foreground calls

Zblog system realizes the tutorial of the number of articles published on the same day when the foreground calls

2022-06-24 16:48:00 Shell house railing - Wenxi

I'm making a Zblog You need to call the number of articles published today when using the template , After a search , The Internet is basically for 24 Number of articles published within hours , After that, the problem was solved through query verification , Record the method to avoid forgetting .

call ZBlog Website The total number of articles published today needs to write a function to query the database , The method is as follows : In the theme of ”include.php“ Copy and paste the following functions in the file :

function get_todayArticleNum(){
	global $zbp;
	$db = $zbp->db->sql->get();
	$sql = $db->select('zbp_post')->count('log_id', 'num')->where(array(array('=','log_Status','0'),array('CUSTOM','log_PostTime>UNIX_TIMESTAMP(CAST(SYSDATE()AS DATE))')))->sql;	
	$result = GetValueInArrayByCurrent($zbp->db->Query($sql), 'num');
	return $result;}

Add the following calling code where you want to display the statistics

{get_todayArticleNum()}

After the above steps are completed , Go to the background homepage and click 【 Empty cache And recompile the template 】 that will do .

原网站

版权声明
本文为[Shell house railing - Wenxi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241644368853.html