帝国CMS用户自定义函数取昨天发表的文章数
2014-09-21 站长 站长日志
用户自己定义函数添加方法:
1.函数内容代码:
<?php function user_ztotal($classid){ global $empire,$class_r,$dbtbpre; $beginYesterday = mktime(0, 0, 0, date("m"), date("d") -1, date("Y")); $endYesterday = mktime(0,0,0,date("m") ,date("d"),date("Y")); $query="select count(*) as total from {$dbtbpre}ecms_".$class_r[$classid][tbname]." WHERE classid=".$classid." and newstime BETWEEN ".$beginYesterday." AND ".$endYesterday; $num=$empire->gettotal($query); echo $num; } ?>
2.将函数内容复制到e/class/userfun.php文件里
3.登陆后台->“模板管理”->“管理标签”->“增加标签”: