本文整理自网络,侵删。
介绍了帝国cms系统中通过用户自定义函数获取用户发表新闻数量的方法,主要是分享下帝国cms自定义函数功能。
在帝国cms中实现获取用户发表的新闻数量,没有现成的方法,不过可以用自定义函数来实现,一起来看看。
帝国cms中添加用户自定义函数。
就是在e/class/userfun.php文件中加下如下函数即可:
1,核心函数内容:
代码如下:
<?php </p> <p>function get_newstotal($userid){
global $empire,$class_r,$dbtbpre;
$query="select count(*) as total from {$dbtbpre}ecms_news WHERE userid=".$userid." "; // sql语句
$num=$empire->gettotal($query);
echo $num;
}
?>
2,将函数内容复制到e/class/userfun.php文件中。
3,登陆后台->“模板管理”->“管理标签”->“增加标签”。
4,调用[newstotal]用户ID[/newstotal]。
<?php </p> <p>function get_newstotal($userid){
global $empire,$class_r,$dbtbpre;
$query="select count(*) as total from {$dbtbpre}ecms_news WHERE userid=".$userid." "; // sql语句
$num=$empire->gettotal($query);
echo $num;
}
?>
2,将函数内容复制到e/class/userfun.php文件中。
3,登陆后台->“模板管理”->“管理标签”->“增加标签”。
4,调用[newstotal]用户ID[/newstotal]。
如此,便实现了帝国cms中用户自定义函数调用新闻数量了,很简单吧。
标签:帝国CMS
相关阅读 >>
通过syntaxhighlight实现帝国CMS代码高亮语法高亮(二) 在编辑器中加载
帝国CMS7.5编辑器换行替换为p标记,如何将标签br换成p标签
更多相关阅读请进入《帝国CMS》频道 >>
相关推荐
评论
管理员已关闭评论功能...
- 欢迎访问木庄网络博客
- 可复制:代码框内的文字。
- 方法:Ctrl+C。