首先我们来帝国CMS调用专题列表,新建一个自定义列表,代码如下

统计记录:

select count(*) as total from [!db.pre!]enewszt

查询记录:

select ztname as title,ztpath as newspath,ztimg as titlepic,intro as smalltext,ztpath as classid,onclick,ztid as id from [!db.pre!]enewszt

然后写列表页的模板,勾选“使用程序代码”,代码如下:

$tiao=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsztinfo where ztid='$r[id]'"); $tj=$empire->fetch1("select newstime from {$dbtbpre}enewsztinfo where ztid='$r[id]'"); $tian=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsztinfo where ztid='$r[id]' and '$tj[newstime]'>UNIX_TIMESTAMP()-86400*7"); $yue=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsztinfo where ztid='$r[id]' and '$tj[newstime]'>UNIX_TIMESTAMP()-86400*30"); $listtemp='<li>     <a href="/[!--classid--]">         <img src="[!--titlepic--]">     </a>     <div class="txt">         <h4><a href="/[!--classid--]">[!--title--]</a></h4>         <p><i><b>'.$tiao.'</b>个讨论</i> <i><b>[!--onclick--]</b>个关注</i></p>         <span>7天新增<b>'.$tian.'</b>个讨论, 30天新增<b>'.$yue.'</b>个讨论</span>     </div>     <a href="/[!--classid--]" class="add">+关注</a> </li>';

附注:

第一段$tiao为统计当前专题的所有信息数量,$tj为查询当前专题的newstime字段,$tian为统计ztid等于当前专题ID并时间等于7天的信息,$yue同理是统计的30天的信息。

历史上的今天
12月
16
    抱歉,历史上的今天作者很懒,什么都没写!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。