原帖由 hydeist 于 2006-10-4 21:22 发表
太强了,我就要这样的,那个123456789那个图标不要,也没事的。
能发出修改的方案出来不?
我对代码不是很了解,基本是从stats.php照搬过来的,可能搬的有点罗嗦,谁有时间给改改。
index.php
- } else {
- $showoldetails = false;
- }
复制代码
下面加(个人认为这部分可能还可以优化,简洁的余地)
- //--首页四格增加 Start--
- //24小时发帖排行
- $postsrank = '';
- $statvars = array();
- $query = $db->query("SELECT * FROM {$tablepre}statvars WHERE type='postsrank'");
- while($variable = $db->fetch_array($query)) {
- $statvars[$variable['variable']] = $variable['value'];
- }
- if($timestamp - $statvars['lastupdate'] > $statscachelife) {
- $statvars = array('lastupdate' => $timestamp);
- $db->query("REPLACE INTO {$tablepre}statvars (type, variable, value)
- VALUES ('postsrank', 'lastupdate', '$timestamp')");
- }
- $posts = $digestposts = $thismonth = $today = array();
- if(isset($statvars['today'])) {
- $today = unserialize($statvars['today']);
- } else {
- $query = $db->query("SELECT DISTINCT(author) AS username, COUNT(pid) AS posts
- FROM {$tablepre}posts WHERE dateline >='$timestamp'-86400 AND invisible='0' AND authorid>'0'
- GROUP BY author ORDER BY posts DESC LIMIT 0, 20");
- while($member = $db->fetch_array($query)) {
- $today[] = $member;
- }
- $db->query("REPLACE INTO {$tablepre}statvars (type, variable, value)
- VALUES ('postsrank', 'today', '".addslashes(serialize($today))."')");
- }
- for($i = 0; $i < 10; $i++) {
- $postsrank .= "<tr><td width="60%"><li type="square"> <a href="viewpro.php?username=".rawurlencode($today[$i]['username'])."" target="_blank">{$today[$i][username]}</a></td><td align="right" width="40%">[<font color="red">{$today[$i][posts]}</font>]</td></tr>\n";
- }
- //
- //在线时间排行
- $onlines = '';
- $statvars = array();
- $query = $db->query("SELECT * FROM {$tablepre}statvars WHERE type='onlines'");
- while($variable = $db->fetch_array($query)) {
- $statvars[$variable['variable']] = $variable['value'];
- }
- $total = $thismonth = array();
- if(isset($statvars['total'])) {
- $total = unserialize($statvars['total']);
- } else {
- $query = $db->query("SELECT o.uid, m.username, o.total AS time
- FROM {$tablepre}onlinetime o
- LEFT JOIN {$tablepre}members m USING (uid)
- ORDER BY o.total DESC LIMIT 20");
- while($online = $db->fetch_array($query)) {
- $online['time'] = round($online['time'] / 60, 2);
- $total[] = $online;
- }
- $db->query("REPLACE INTO {$tablepre}statvars (type, variable, value)
- VALUES ('onlines', 'total', '".addslashes(serialize($total))."')");
- }
- for($i = 0; $i < 10; $i++) {
- $onlines .= "<tr><td width="60%"><li type="square"> <a href="viewpro.php?uid={$total[$i][uid]}" target="_blank">{$total[$i][username]}</a></td><td align="right" width="40%">{$total[$i][time]} 时</td>\n";
- }
- //
- $hack_subject_len=30; //标题最多显示的字数
- $hack_subject_num=10; //最新主题与回复显示的数量
- //最新主题
- $query = $db->query("SELECT dateline,tid,subject,author,views,replies FROM {$tablepre}threads 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 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--
复制代码
hot_topics.htm
-
- <table cellspacing="0" cellpadding="0" border="0" width="{TABLEWIDTH}" align="center" class="tableborder">
- <tr>
- <td>
- <table border="0" cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" style="table-layout: fixed; word-wrap: break-word" >
- <tr class="header">
- <td width="27%" align="center">最新发表主题</td>
- <td width="23%" align="center">最新回复主题</td>
- <td width="25%" align="center">24小时发帖排行</td>
- <td width="25%" align="center">在线时间排行</td>
- </tr>
- <tr>
- <td bgcolor="{ALTBG2}" onMouseOver ="this.style.backgroundColor='{ALTBG1}'" onMouseOut ="this.style.backgroundColor='{ALTBG2}'">
- <table width="100%" cellpadding="{TABLESPACE}" cellspacing="{INNERBORDERWIDTH}">
- <!--{loop $hack_newthreads_threadlist $thread}-->
- <tr><td><li><a href="viewthread.php?tid=$thread[tid]" title="主题:$thread[subject0]{LF}作者:$thread[author]{LF}浏览:$thread[views] 次 回复:$thread[replies] 次">$thread[subject]</a><!--{if $thread[creditsrequire]}--> - [{lang credit_title}<span class="bold">$thread[creditsrequire]</span>{lang credit_unit}] <!--{/if}-->$thread[multipage]</li></tr></td>
- <!--{/loop}-->
- </table>
- </td>
- <td bgcolor="{ALTBG2}" onMouseOver ="this.style.backgroundColor='{ALTBG1}'" onMouseOut ="this.style.backgroundColor='{ALTBG2}'">
- <table width="100%" cellpadding="{TABLESPACE}" cellspacing="{INNERBORDERWIDTH}">
- <!--{loop $threadreply $thread}-->
- <tr><td><li><a href="redirect.php?tid=$thread[tid]&goto=lastpost#lastpost" title="主题:$thread[subject0]{LF}作者:$thread[author]{LF}浏览:$thread[views] 次{LF}回复:$thread[replies] 次{LF}{lang lastpost}:$thread[lastposter]">$thread[subject]</a><!--{if $thread[creditsrequire]}--> - [{lang credit_title}<span class="bold">$thread[creditsrequire]</span>{lang
- credit_unit}] <!--{/if}--> $thread[multipage]</li></tr></td>
- <!--{/loop}-->
- </table>
- </td>
- <td bgcolor="{ALTBG2}" onMouseOver ="this.style.backgroundColor='{ALTBG1}'" onMouseOut ="this.style.backgroundColor='{ALTBG2}'">
- <table width="100%" cellpadding="{TABLESPACE}" cellspacing="{INNERBORDERWIDTH}">
- $postsrank
- </table>
- </td>
- <td bgcolor="{ALTBG2}" onMouseOver ="this.style.backgroundColor='{ALTBG1}'" onMouseOut ="this.style.backgroundColor='{ALTBG2}'">
- <table width="100%" cellpadding="{TABLESPACE}" cellspacing="{INNERBORDERWIDTH}">
- $onlines
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table><br />
复制代码
discuz.htm
- $lastmember</span></a>
- </div>
- </div><br>
复制代码
后面加上
这个出来的效果比上面的图要好看点,后来把最新主题/回复放左边了,也加了<li></li>
看一下这个方案的图吧。
[ 本帖最后由 Clwarm 于 2006-10-4 22:33 编辑 ] |