帝国cms插件编写教程 帝国CMS会员中心如何动态提示未读消息

帝国CMS教程

登陆帝国后台------模板------动态页面模板管理------头部模板在模型下面添加下面代码部分

<?//模型$tgetmid=(int)$_GET['mid'];if($tmgetuserid){$member=$empire->fetch1("selectuserpicfromphome_enewsmemberaddwhereuserid='$tmgetuserid'");$msgcount=$empire->gettotal("selectcount(*)astotalfrom{$dbtbpre}enewsqmsgwhereto_username='$user[username]'andhaveread='0'");}?>

然后在你想要放未读消息位置调用一下代码 一下代码CSS 样式自行修改

 

<?if($msgcount>0){?><!--新消息start--><liid="topmenu_ZCenterCart"><ahref="#ecms"onclick="window.open('<?=$public_r['newsurl']?>e/member/vipmsg/index.php','','width=680,height=500,scrollbars=yes,resizable=yes');"><fontcolor=red>你有未读消息<?=$msgcount?>条</font></a></li><!--新消息end--><?}?>