Home > Article > CMS Tutorial > Sharing Empire CMS uses user-defined functions to get the number of published news
Add user-defined function
1. The function content is as follows:
The code is as follows:
<?php function user_newstotal($userid){ global $empire,$class_r,$dbtbpre; $query="select count(*) as total from {$dbtbpre}ecms_news WHERE userid=".$userid." "; $num=$empire->gettotal($query); echo $num; } ?>
2. Copy the function content to the e/class/userfun.php file
3. Log in to the backend->"Template Management"->"Manage Tags"->"Add Tags"
4. Call [newstotal]User ID[/newstotal]
Recommended to study "Empirecms Tutorial"
The above is the detailed content of Sharing Empire CMS uses user-defined functions to get the number of published news. For more information, please follow other related articles on the PHP Chinese website!