注意一定要删除相关查询语句,不然起不到加速的作用!!
首页四格(访客信息+论坛档案+最新主题+最新回复)+新手DIY方案 For Discuz! 5.0.0
https://discuz.dismall.com/thread-418450-1-1.html
相关语句:
- //--首页四格增加 Start--
- $hack_subject_len=34; //标题最多显示的字数
- $hack_subject_num=12; //最新主题与回复显示的数量
- //最新主题
- $query = $db->query("SELECT dateline,tid,subject,author,views,replies FROM {$tablepre}threads and displayorder!=-1 and displayorder!=-2 ORDER BY dateline DESC LIMIT 0, $hack_subject_num");
- while($thread = $db->fetch_array($query)) {
- $thread[subject0]=$thread[subject];
- $thread['subject'] = cutstr($thread['subject'], $hack_subject_len);
- $hack_newthreads_threadlist[] = $thread;
- }
- $threadview = $threadreply = array();
- //最新回复
- $query = $db->query("SELECT replies, tid, subject,author,views,lastposter FROM {$tablepre}threads where replies !=0 and displayorder!=-1 and displayorder!=-2 ORDER BY lastpost DESC LIMIT 0, $hack_subject_num");
- while($thread = $db->fetch_array($query)) {
- $thread[subject0]=$thread[subject];
- $thread[subject] = cutstr($thread[subject], $hack_subject_len);
- $threadreply[] = $thread;
- }
- //--首页四格增加 End--
复制代码
Dz首页5格3叠dingo免升级数据库绿色查询预览版 V2.0.1024 For Dz5.0 [最后更新1024]
https://discuz.dismall.com/thread-431565-1-1.html
此插件的下个版本将采用本补丁,大家期待下
Dz首页5格3叠dingo免升级数据缓存版 For Dz5.0 [全DIV+CSS版]
相关语句:
- ///////////////////////////////////////////////////////////////////////
- /////Dz首页5格3叠dingo免升级数据库绿色查询版 BY Rockoy And Flash菲/////
- ////////////////////注意:以下代码原作者是happy0429//////////////////////////
- ///////////////////////////////////////////////////////////////////////
- $hack_subject_len=40; //每个标题最多显示得字数
- $hack_subject_num=10; //需要显示记录数
- $hack_newthreads_threadlist = array();
- $thread = array();
- //最新贴开始
- $query = $db->query("SELECT dateline,tid,subject,author,views,replies,lastpost,lastposter FROM {$tablepre}threads WHERE fid ORDER BY dateline DESC LIMIT 0, $hack_subject_num");
- while($thread = $db->fetch_array($query)) {
- $thread['forumname'] = $thread['name'];
- $thread['date']= gmdate("$dateformat $timeformat", $thread['dateline'] + $timeoffset * 3600);
- $thread['lastreplytime']= gmdate("$dateformat $timeformat", $thread[lastpost] + ($timeoffset * 3600));
- $thread[subject0]=$thread[subject];
- $thread['subject'] = cutstr($thread['subject'], $hack_subject_len);
- $hack_newthreads_threadlist[] = $thread;
- }
- //最新贴结束
- $threadview = $threadreply = array();
- //最新回复开始
- $query = $db->query("SELECT dateline,tid,subject,author,views,replies,lastpost,lastposter FROM {$tablepre}threads WHERE fid NOT IN(199,999) AND replies > 0 ORDER BY lastpost DESC LIMIT 0, $hack_subject_num");
- while($thread = $db->fetch_array($query)) {
- $thread[subject0]=$thread[subject];
- $thread['forumname'] = $thread['name'];
- $thread['date']= gmdate("$dateformat $timeformat", $thread['dateline'] + $timeoffset * 3600);
- $thread['lastreplytime']= gmdate("$dateformat $timeformat", $thread[lastpost] + ($timeoffset * 3600));
- $thread[subject] = cutstr($thread[subject], $hack_subject_len);
- $threadreply[] = $thread;
- }
- //最新回复结束
- //热帖开始
- $hack_cut_str = 40; //修改标题显示字数
- $hack_cut_strauthor = 10; //需要显示记录数
- //这个可以选择安装或者不安装//
- //热贴指定天数//
- $this_time= time();
- $sort_time = $today - ( 60*60*24*9999); //7天内
- $new_hot_threadlist = array();
- $mthread = array();
- $query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 and t.dateline > $sort_time ORDER BY t.views DESC LIMIT 0, 10");
- while($mthread = $db->fetch_array($query)) {
- $mthread['forumname'] = $mthread['name'];
- $mthread['view_subject'] = cutstr($mthread['subject'],$hack_cut_str);
- $mthread['view_lastposter'] = cutstr($mthread['lastposter'],$hack_cut_strauthor);
- $mthread['date']= gmdate("$dateformat $timeformat", $mthread['dateline'] + $timeoffset * 3600);
- $mthread['lastreplytime']= gmdate("$dateformat $timeformat", $mthread[lastpost] + ($timeoffset * 3600));
- if($mthread['highlight']) {
- $string = sprintf('%02d', $mthread['highlight']);
- $stylestr = sprintf('%03b', $string[0]);
- $mthread['highlight'] = 'style="';
- $mthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
- $mthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
- $mthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
- $mthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
- $mthread['highlight'] .= '"';
- } else {
- $mthread['highlight'] = '';
- }
- $new_hot_threadlist[] = $mthread;
- }
- //热帖结束
- //精华帖开始
- $hack_cut_str =40; //修改标题显示字数
- $hack_cut_strauthor = 10; //需要显示记录数
- $new_digest_threadlist = array();
- $dthread = array();
- $query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE digest>'0' AND t.fid<>'$fid' AND f.fid=t.fid ORDER BY t.dateline DESC LIMIT 0, 10"); //修改显示帖子条数
- while($dthread = $db->fetch_array($query)) {
- $dthread['forumname'] = $dthread['name'];
- $dthread['view_subject'] = cutstr($dthread['subject'],$hack_cut_str);
- $dthread['view_author'] = cutstr($dthread['author'],$hack_cut_strauthor);
- $dthread['date']= gmdate("$dateformat $timeformat", $dthread['dateline'] + $timeoffset * 3600);
- $dthread['lastreplytime']= gmdate("$dateformat $timeformat", $dthread[lastpost] + ($timeoffset * 3600));
- if($dthread['highlight']) {
- $string = sprintf('%02d', $dthread['highlight']);
- $stylestr = sprintf('%03b', $string[0]);
- $dthread['highlight'] = 'style="';
- $dthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
- $dthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
- $dthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
- $dthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
- $dthread['highlight'] .= '"';
- } else {
- $dthread['highlight'] = '';
- }
- $new_digest_threadlist[] = $dthread;
- }
- //精华帖结束
- ///////////////////////////////////////////////////////////////////////
- ////////////////////注意:以上代码原作者是happy0429///////////////////////////
- /////Dz首页5格3叠dingo免升级数据库绿色查询版 BY Rockoy And Flash菲/////
- ///////////////////////////////////////////////////////////////////////
复制代码
和- $malenum = $femalenum = $nofmnum = 0;
- $query = $db->query("SELECT gender FROM {$tablepre}members");
- while($chk = $db->fetch_array($query)) {
- if($chk['gender'] == '1') {
- $malenum++;
- } else if($chk['gender'] == '2') {
- $femalenum++;
- } else {
- $nofmnum++;
- }
- }
复制代码
[ 本帖最后由 wxyuan90 于 2006-11-5 15:58 编辑 ] |