$q = DB::query("SELECT todayposts,
threads, posts FROM ".DB::table('forum_forum')." WHERE type='forum'");
while($12345la = DB::fetch($q)) {
$todayposts += $12345la['todayposts'];
$threads += $12345la['threads'];
$posts += $12345la['posts'];
}
解釋一下,先查詢出 pre_forum_forum 這個版塊信息數據表,過濾掉羣組,然後再把字段裏面的值合併累加,然後再進行變量輸出:
論壇今日發帖總數:$todayposts 論壇主題總數:$threads 論壇總貼數:$posts
可能有很多童鞋不字段如何用?
把上面那段代碼放到相應的程序文件最後?> 前面,然後把上面三個變量寫到模板裏去,更新緩存試試
如果有不懂的地方,請跟帖發問,但是不動手的懶人我表示鄙視!
作者:cr180
地址:http://www.12345.la/thread-13010-1-1.html