ajdfajdfl
|
分享:
x0
|
[][分享] [完整版]首頁四格 for Discuz! 5.0
在此感謝瑋少 我知道下面有了,可是我覺得這個比較完整,轉貼自AL8 Forum。首頁四格(含高亮顯示)修改只需3步,for Discuz! 5.0 適用版本:discuz5.0 作者:ytc 修改:瑋少 修改文件:index.php 修改模板:index.htm 功能:含高亮顯示,但會增加兩個查詢 演示: http://www.superairh...dex.php1.上傳模版indexfour.htm到templates/default 2.修改index.php 找 $newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;在下面加上 //新貼// $hack_cut_str = 36; //修改標題顯示字數 $new_post_threadlist = array(); $nthread = array(); $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray'); $query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid ORDER BY t.dateline DESC LIMIT 0, 10"); while($nthread = $db->fetch_array($query)) { $nthread['forumname'] = $nthread['name']; $nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str); $nthread['date']= gmdate("$dateformat $timeformat", $nthread['dateline'] + $timeoffset * 3600); $nthread['lastreplytime']= gmdate("$dateformat $timeformat", $nthread[lastpost] + ($timeoffset * 3600)); if($nthread['highlight']) { $string = sprintf('%02d', $nthread['highlight']); $stylestr = sprintf('%03b', $string[0]); $nthread['highlight'] = 'style="' $nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '' $nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '' $nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '' $nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '' $nthread['highlight'] .= '"' } else { $nthread['highlight'] = '' }
$new_post_threadlist[] = $nthread; } //新貼// //新回覆 $hack_cut_str = 36; //修改標題顯示字數 $new_reply_threadlist = array(); $rthread = array(); $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray'); $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 ORDER BY t.lastpost DESC LIMIT 0, 10"); while($rthread = $db->fetch_array($query)) { $rthread['forumname'] = $rthread['name']; $rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str); $rthread['date']= gmdate("$dateformat $timeformat", $rthread['dateline'] + $timeoffset * 3600); $rthread['lastreplytime']= gmdate("$dateformat $timeformat", $rthread[lastpost] + ($timeoffset * 3600)); if($rthread['highlight']) { $string = sprintf('%02d', $rthread['highlight']); $stylestr = sprintf('%03b', $string[0]); $rthread['highlight'] = 'style="' $rthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '' $rthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '' $rthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '' $rthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '' $rthread['highlight'] .= '"' } else { $rthread['highlight'] = '' }
$new_reply_threadlist[] = $rthread; } //回覆//3.修改Discuz.htm 找 <div style="width: {TABLEWIDTH}; clear: both; overflow: hidden;">
<div class="left" style="line-height: 18px;"> <span class="bold"><!--{if $gid || !$discuz_uid}--><a href="$indexname">$bbname</a><!--{else}-->$discuz_user<!--{/if}--> <!--{if $supe_status && $discuz_uid}--> - <!--{if !$xspacestatus}--> <a href="$supe_siteurl/index.php?action/register" target="_blank">{lang supe_signin_xspace}</a> <!--{else}--> <a href="$supe_siteurl/index.php?action/space/uid/$discuz_uid" target="_blank">{lang supe_myxspace}</a> <!--{/if}--> <!--{/if}--> </span> <br> {lang credits}: <span class="bold smalltxt">$credits</span> <span id="creditlist">{lang credits_detail}<script type="text/javascript">menuregister(false, "creditlist", true)</script></span> / {lang index_status}: <!--{if $validdays}--> <a href="member.php?action=groupexpiry"><span class="bold">$grouptitle</span>($validdays)</a> <!--{else}--> <span class="bold">$grouptitle</span><!--{/if}--> <!--{if $allowinvisible && $discuz_uid}-->{lang online_status}: <!--{if !empty($invisible)}--> <a href="member.php?action=switchstatus" title="{lang login_switch_normal_mode}">{lang login_invisible_mode}</a> <!--{else}--> <a href="member.php?action=switchstatus" title="{lang login_switch_invisible_mode}">{lang login_normal_mode}</a> <!--{/if}--> <!--{/if}--><br> {lang your_lastvisit} <span class="smalltxt">$lastvisittime</span><br> </div>
<div class="right" style="line-height: 18px;"> <a href="search.php?srchfrom=$newthreads&searchsubmit=yes">{lang show_newthreads}</a> | <!--{if $discuz_uid}--> <!--{if $allowuseblog}--> <a href="blog.php?uid=$discuz_uid" target="_blank">{lang blog}</a> | <!--{/if}--> <!--{/if}--> <a href="digest.php">{lang digest}</a> | <a href="member.php?action=markread">{lang mark_read}</a> <!--{if $rssstatus}--><a href="rss.php?auth=$rssauth" target="_blank"><img src="images/common/xml.gif" border="0" class="absmiddle" alt="{lang rss_subscribe_all}" /></a><!--{/if}--> <br> {lang total} <span class="smalltxt">$threads</span> {lang index_threads} / <span class="smalltxt">$posts</span> {lang index_posts} / {lang index_today} <span class="smalltxt">$todayposts</span> {lang index_posts}<br> {lang total} <span class="smalltxt">$totalmembers</span> {lang index_members} / {lang welcome_newmember} <a href="viewpro.php?username=$memberenc"><span class="bold">$lastmember</span></a> </div>
</div><br>
<!--{if empty($gid)}--> <!--{if !empty($announcements)}--> <div id="announcement" style="clear: both; width: {TABLEWIDTH}">$announcements</div> <script type="text/javascript">announcement();</script> <!--{/if}--> <!--{if $qihoo_status && $searchboxstatus}--> <div class="subtable" style="clear: both; width: {TABLEWIDTH}"> <div class="right"> <form method="post" action="search.php?srchtype=qihoo" onSubmit="this.target='_blank'"> <input type="hidden" name="searchsubmit" value="yes"> <input type="text" name="srchtxt" value="$qihoo_searchboxtxt" size="30" class="input" style="{BGCODE};" onmouseover="this.focus();this.value=''this.onmouseover=null;"> <select name="stype"><option value="" selected>{lang qihoo_search_filltext}</option><option value="1">{lang qihoo_search_title}</option><option value="2">{lang qihoo_search_author}</option></select> <input name="searchsubmit" class="button" type="submit" value="{lang search}"> </form> </div> <!--{if $qihoo_links['keywords']}--> <span class="bold">{lang qihoo_hot_searches}</span> <!--{loop $qihoo_links['keywords'] $link}--> $link <!--{/loop}--> <!--{/if}--> </div> <div class="subtable" style="clear: both; width: {TABLEWIDTH}"> <div class="right"> <!--{if $customtopics}--> <span class="bold">{lang qihoo_custom_topics}</span> $customtopics [<a href="###" onclick="window.open('misc.php?action=customtopics', '', 'width=320,height=450,resizable=yes,scrollbars=yes');">{lang edit}</a>] <!--{/if}--> </div> <!--{if $qihoo_links['topics']}--> <span class="bold">{lang qihoo_topics}</span> <!--{loop $qihoo_links['topics'] $url}--> {$url} <!--{/loop}--> <!--{/if}--> </div> <!--{/if}--> <!--{/if}-->修改為 <!--{if !empty($announcements)}--> <div id="announcement" style="clear: both; width: {TABLEWIDTH}">$announcements</div> <script type="text/javascript">announcement();</script> <!--{/if}--> <!--{if empty($gid)}--> {template indexfour} <!--{/if}-->
[ 此文章被ajdfajdfl在2007-01-31 09:09重新編輯 ]
|