
標題: AL8 首頁四格顯示 for Discuz 6.0.0 [列印本頁]
作者: Linux0911 時間: 2007-10-25 10:25 PM 標題: AL8 首頁四格顯示 for Discuz 6.0.0
from: AL8 Forum http://www.alan888.com/Discuz/viewthread.php?tid=85947
請先安裝:在 XHTML 1.0 也可正常運行的 ALT POP UP JS for 6.0.0
作 者: alan888
適用版本: Discuz 6.0.0
6.0.0 修改: Linux0911
修改文件: index.php, logging.php, topicadmin.php, include/newthread.inc.php, include/newreply.inc.php, include/editpost.inc.php, include/counter.inc.php, include/cache.func.php, index 模板
加入文件: foruminfo 模板 (附件 1)
演 示: AL8 Forum
本插件因是按本站的條件編寫, 故這插件不含安全登錄及驗証登錄, 但有連結到登錄頁面
所以在下列動作時只會增加資料庫查詢 1-2 次:
1. 會員註冊: 1 次 (當天註冊人數更新)
2. 會員登錄: 1 次 (當天到訪人數更新)
3. 發新帖: 1 次 (最新發表文章更新)
4. 回帖: 2 次 (最新發表文章及最新回覆文章更新)
5. 管理動作執行: 2 次 (最新發表文章及最新回覆文章更新)
本站曾經嘗試使用 Discuz 6 的 JS 調用功能, 但更新不及時而速度也跟本插件相若, 故最後還是使用此插件的辦法
注意:
1. 安裝此插件非常繁瑣, 對初學者不建議使用;
2. "是日到訪會員" 的資料是根據會員執行登錄程序後更新, 如會員使用 cookies 登錄, 資料會在下次其他會員使用登錄程序後才更新;
3. 請子細閱讀每個安裝程序, 尤其修改 cache.func.php 部份
4. 四格顯示只提供快速登錄, 但有安全登錄連結
5. 積分政策按兩種而設, 超過兩種左手邊第一格會較高, 可增加發帖及回帖的顯示數量平衡, 在 include/cache.func.php 內找 "DESC LIMIT 0, 11" 將 11 (顯示 11 行) 改為修改後的行數
12. 如需顯示主題分類在四格裡面, 請參閱 FAQ 部分
安裝程序 INSTALL
1. 修改 ./include/cache.func.php
修改完成此文件後請即時到後台 → 更新快取 (utf-8 使用者請將檔案存為 utf-8 格式才可正常使用)
找複製內容到剪貼簿
代碼:
'medals' => array('medals'),下面添加複製內容到剪貼簿
代碼:
// AL8 首頁四格顯示 - START
'newtopic' => array('newtopic'),
'newreply' => array('newreply'),
'todayvisit' => array('todayvisit'),
// AL8 首頁四格顯示 - END再找複製內容到剪貼簿
代碼:
case 'medals':
$table = 'medals';
$cols = 'medalid, name, image';
$conditions = "WHERE available='1'";
break;在下面加上 (注意先填妥紅字部份)填上不需要顯示帖子區域
由於使用快取檔型式, 故某些私密區不能判斷會員權限來顯示發帖及回帖, 所以要先修改及取代下紅字部份 "填上不需要顯示帖子區域的 fid 編號, 以逗號作分格, 最後一個不用加上逗號" 部份, 例如希望不顯示 fid 1,3,5 便填上 "$fids="1,3,5";"
如果希望全部顯示者, 請將下兩段的NOT IN ($fids) (藍色字顯示部份)刪除, 否則會出現數據錯誤的顯示
橘色的數值表示顯示的筆數, 可以依需求修改顯示數量引用:
// AL8 首頁四格顯示 - START
case 'newtopic':
$table = 'threads t, '.$tablepre.'forums f';
$cols = "t.tid, t.subject, t.author, t.dateline, t.views, t.replies, t.lastpost, t.lastposter, t.highlight, f.name";
$fids="填上不需要顯示發新帖區域的 fid 編號, 以逗號作分格, 最後一個不用加上逗號";//例如 "1,2,3";
$conditions = "WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid NOT IN ($fids) ORDER BY t.dateline DESC LIMIT 0, 11";
break;
case 'newreply':
$table = 'threads t, '.$tablepre.'forums f';
$cols = "t.tid, t.subject, t.author, t.dateline, t.views, t.replies, t.lastpost, t.lastposter, t.highlight, f.name";
$fids="填上不需要顯示回帖區域的 fid 編號, 以逗號作分格, 最後一個不用加上逗號";//例如 "1,2,3";
$conditions = "WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid NOT IN ($fids) AND t.replies !=0 ORDER BY t.lastpost DESC LIMIT 0, 11";
break;
case 'todayvisit':
$table = 'members';
$cols = "COUNT(*)";
$datecut = time() - (3600 * 24);
$conditions = "WHERE lastactivity>='$datecut' ORDER BY lastvisit DESC";
break;
// AL8 首頁四格顯示 - END
找複製內容到剪貼簿
代碼:
$GLOBALS['totalmembers'] = $data['totalmembers'] = $db->result($query, 0);在下面添加複製內容到剪貼簿
代碼:
// AL8 首頁四格顯示 - START
$datecut = time() - (3600 * 24);
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}members WHERE regdate>='$datecut'");
$GLOBALS['todaynewmems'] = $data['todaynewmems'] = $db->result($query, 0);
// AL8 首頁四格顯示 - END找複製內容到剪貼簿
代碼:
case 'forumlinks':
global $forumlinkstatus;
if($forumlinkstatus) {
$tightlink_text = $tightlink_logo = '';上面加上引用:
// AL8 首頁四格顯示 - START
case 'newreply':
$hack_cut_str = 26;
$new_reply_threadlist = array();
$rthread = array();
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
while($rthread = $db->fetch_array($query)){
$rthread['forumname'] = $rthread['name'];
$rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
$rthread['subject'] = cutstr($rthread['subject'],46);
$rthread['date']= gmdate('Y-n-j G:i', $rthread['dateline'] + 8 * 3600);
$rthread['lastreplytime']= gmdate('Y-n-j G:i', $rthread['lastpost'] + 8 * 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 = "<a href=\"redirect.php?tid=$rthread[tid]&goto=lastpost#lastpost\" title=\"論壇: $rthread[forumname]\r\n標題: $rthread[subject]\r\n作者: $rthread[author]\r\n發表時間: $rthread[date]\r\n瀏覽次數: $rthread[views] 次\r\n回覆: $rthread[replies] 次\r\n最後回覆: $rthread[lastreplytime]\r\n最後發表: $rthread[lastposter]\" $rthread[highlight]>$rthread[view_subject]</a><br />";
$data[] = array('content' => $new_reply_threadlist);
}
break;
case 'newtopic':
$hack_cut_str = 26;
$new_post_threadlist = array();
$nthread = array();
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
while($nthread = $db->fetch_array($query)){
$nthread['forumname'] = $nthread['name'];
$nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
$nthread['subject'] = cutstr($nthread['subject'],46);
$nthread['date']= gmdate('Y-n-j G:i', $nthread['dateline'] + 8 * 3600);
$nthread['lastreplytime']= gmdate('Y-n-j G:i', $nthread[lastpost] + 8 * 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[replies] ? "<a href=\"redirect.php?tid=$nthread[tid]&goto=lastpost#lastpost\" title=\"論壇: $nthread[forumname]\r\n標題: $nthread[subject]\r\n作者: $nthread[author]\r\n發表時間: $nthread[date]\r\n瀏覽次數: $nthread[views] 次 \r\n回覆: $nthread[replies] 次\r\n最後回覆: $nthread[lastreplytime]\r\n最後發表: $nthread[lastposter]\" $nthread[highlight] >$nthread[view_subject]</a><br />" : "<a href=\"redirect.php?tid=$nthread[tid]&goto=lastpost#lastpost\" title=\"論壇: $nthread[forumname]\r\n標題: $nthread[subject]\r\n作者: $nthread[author]\r\n發表時間: $nthread[date]\r\n瀏覽次數: $nthread[views] 次\r\n回覆: 暫時沒有回覆\" $nthread[highlight] >$nthread[view_subject]</a><br />";
$data[] = array('content' => $new_post_threadlist);
}
break;
// AL8 首頁四格顯示 - END
上面這段其中的
case 'newreply':
$hack_cut_str = 26;
case 'newtopic':
$hack_cut_str = 26;
紅字可自行修改顯示在四格上的字數
2. 修改 ./include/newthread.inc.php
找複製內容到剪貼簿
代碼:
showmessage('post_newthread_succeed', "viewthread.php?tid=$tid&extra=$extra".(!empty($frombbs) ? "&frombbs=$frombbs" : ''));在上面添加複製內容到剪貼簿
代碼:
// AL8 首頁四格顯示 - START
require_once DISCUZ_ROOT.'./include/cache.func.php';
updatecache('newtopic');
// AL8 首頁四格顯示 - END3. 修改 ./include/newreply.inc.php
找複製內容到剪貼簿
代碼:
showmessage($replymessage, "viewthread.php?tid=$tid&pid=$pid&page=".(@ceil(($thread['special'] ? $thread['replies'] + 1 : $thread['replies'] + 2) / $ppp))."&extra=$extra#pid$pid");在上面添加複製內容到剪貼簿
代碼:
// AL8 首頁四格顯示 - START
require_once DISCUZ_ROOT.'./include/cache.func.php';
updatecache('newreply');
updatecache('newtopic');
// AL8 首頁四格顯示 - END4. 修改 ./include/editpost.inc.php
找複製內容到剪貼簿
代碼:
$discuz_action = 13;在下面添加複製內容到剪貼簿
代碼:
// AL8 首頁四格顯示 - START
require_once DISCUZ_ROOT.'./include/cache.func.php';
// AL8 首頁四格顯示 - END找複製內容到剪貼簿
代碼:
$db->query("DELETE FROM {$tablepre}polls WHERE tid='$tid'");在下面添加複製內容到剪貼簿
代碼:
// AL8 首頁四格顯示 - START
updatecache('newtopic');
// AL8 首頁四格顯示 - END找複製內容到剪貼簿
代碼:
$db->query("UPDATE {$tablepre}threads SET replies=replies-'1', attachment='$thread_attachment', lastposter='$lastpost[author]', lastpost='$lastpost[dateline]' WHERE tid='$tid'", 'UNBUFFERED');在下面添加複製內容到剪貼簿
代碼:
// AL8 首頁四格顯示 - START
updatecache('newreply');
updatecache('newtopic');
// AL8 首頁四格顯示 - END5. 修改 ./include/counter.inc.php
找複製內容到剪貼簿
代碼:
if(!$sessionexists) {
if(strpos($visitor['agent'], 'Netscape')) {
$visitor['browser'] = 'Netscape';
} elseif(strpos($visitor['agent'], 'Lynx')) {
$visitor['browser'] = 'Lynx';
} elseif(strpos($visitor['agent'], 'Opera')) {
$visitor['browser'] = 'Opera';
} elseif(strpos($visitor['agent'], 'Konqueror')) {
$visitor['browser'] = 'Konqueror';
} elseif(strpos($visitor['agent'], 'MSIE')) {
$visitor['browser'] = 'MSIE';
} elseif(substr($visitor['agent'], 0, 7) == 'Mozilla') {
$visitor['browser'] = 'Mozilla';
} else {
$visitor['browser'] = 'Other';
}
if(strpos($visitor['agent'], 'Win')) {
$visitor['os'] = 'Windows';
} elseif(strpos($visitor['agent'], 'Mac')) {
$visitor['os'] = 'Mac';
} elseif(strpos($visitor['agent'], 'Linux')) {
$visitor['os'] = 'Linux';
} elseif(strpos($visitor['agent'], 'FreeBSD')) {
$visitor['os'] = 'FreeBSD';
} elseif(strpos($visitor['agent'], 'SunOS')) {
$visitor['os'] = 'SunOS';
} elseif(strpos($visitor['agent'], 'OS/2')) {
$visitor['os'] = 'OS/2';
} elseif(strpos($visitor['agent'], 'AIX')) {
$visitor['os'] = 'AIX';
} elseif(preg_match("/(Bot|Crawl|Spider)/i", $visitor['agent'])) {
$visitor['os'] = 'Spiders';
} else {
$visitor['os'] = 'Other';
}更換為複製內容到剪貼簿
代碼:
// AL8 首頁四格顯示 - START
if(!$sessionexists || $discuz_uid)
{
if(strpos($visitor['agent'], "MSIE 7.0"))
{
$visitor_browser = "Internet Explorer 7.0";
$visitor['browser'] = 'MSIE';
}
elseif(strpos($visitor['agent'], "MSIE 6.0"))
{
$visitor_browser = "Internet Explorer 6.0";
$visitor['browser'] = 'MSIE';
}
elseif(strpos($visitor['agent'], "MSIE 5.5"))
{
$visitor_browser = "Internet Explorer 5.5";
$visitor['browser'] = 'MSIE';
}
elseif(strpos($visitor['agent'], "MSIE 5.0"))
{
$visitor_browser = "Internet Explorer 5.0";
$visitor['browser'] = 'MSIE';
}
elseif(strpos($visitor['agent'], "MSIE 4.01"))
{
$visitor_browser = "Internet Explorer 4.01";
$visitor['browser'] = 'MSIE';
}
elseif(strpos($visitor['agent'], "Netscape"))
{
$visitor_browser = "Netscape";
$visitor['browser'] = 'Netscape';
}
elseif(strpos($visitor['agent'], "Lynx"))
{
$visitor_browser = "Lynx";
$visitor['browser'] = 'Lynx';
}
elseif(strpos($visitor['agent'], "Opera"))
{
$visitor_browser = "Opera";
$visitor['browser'] = 'Opera';
}
elseif(strpos($visitor['agent'], "Konqueror"))
{
$visitor_browser = "Konqueror";
$visitor['browser'] = 'Konqueror';
}
elseif(strpos($visitor['agent'], "Firefox/2.0.0.9"))
{
$visitor_browser = "Mozilla Firefox 2.0.0.9";
$visitor['browser'] = 'Mozilla';
}
elseif(strpos($visitor['agent'], "Firefox/2.0.0.10"))
{
$visitor_browser = "Mozilla Firefox 2.0.0.10";
$visitor['browser'] = 'Mozilla';
}
elseif(strpos($visitor['agent'], "Firefox/2.0.0.11"))
{
$visitor_browser = "Mozilla Firefox 2.0.0.11";
$visitor['browser'] = 'Mozilla';
}
elseif(strpos($visitor['agent'], "Firefox/2.0"))
{
$visitor_browser = "Mozilla Firefox 2.0";
$visitor['browser'] = 'Mozilla';
}
elseif(strpos($visitor['agent'], "Firefox"))
{
$visitor_browser = "Firefox";
$visitor['browser'] = 'Mozilla';
}
elseif(strpos($visitor['agent'], "Mozilla/5.0"))
{
$visitor_browser = "Mozilla";
$visitor['browser'] = 'Mozilla';
}
else
{
$visitor_browser = "其它";
$visitor['browser'] = 'Other';
}
if(strpos($visitor['agent'], "NT 5.1"))
{
if(strpos($visitor['agent'], "SV1"))
{
$visitor_os = "Microsoft Windows XP SP2";
$visitor['os'] = 'Windows';
}
else
{
$visitor_os = "Microsoft Windows XP";
$visitor['os'] = 'Windows';
}
}
elseif(strpos($visitor['agent'], "NT 6.0"))
{
$visitor_os = "Microsoft Windows Vista";
$visitor['os'] = 'Windows';
}
elseif(strpos($visitor['agent'], "NT 5.2"))
{
$visitor_os = "Microsoft Windows Server 2003";
$visitor['os'] = 'Windows';
}
elseif(strpos($visitor['agent'], "NT 5"))
{
$visitor_os = "Microsoft Windows 2000";
$visitor['os'] = 'Windows';
}
elseif(strpos($visitor['agent'], "4.9"))
{
$visitor_os = "Microsoft Windows ME";
$visitor['os'] = 'Windows';
}
elseif(strpos($visitor['agent'], "NT 4"))
{
$visitor_os = "Microsoft Windows NT 4.0";
$visitor['os'] = 'Windows';
}
elseif(strpos($visitor['agent'], "98"))
{
$visitor_os = "Microsoft Windows 98";
$visitor['os'] = 'Windows';
}
elseif(strpos($visitor['agent'], "95"))
{
$visitor_os = "Microsoft Windows 95";
$visitor['os'] = 'Windows';
}
elseif(strpos($visitor['agent'], "Mac"))
{
$visitor_os = "Mac";
$visitor['os'] = 'Mac';
}
elseif(strpos($visitor['agent'], "Linux"))
{
$visitor_os = "Linux";
$visitor['os'] = 'Linux';
}
elseif(strpos($visitor['agent'], "Unix"))
{
$visitor_os = "Unix";
$visitor['os'] = 'Other';
}
elseif(strpos($visitor['agent'], "FreeBSD"))
{
$visitor_os = "FreeBSD";
$visitor['os'] = 'FreeBSD';
}
elseif(strpos($visitor['agent'], "SunOS"))
{
$visitor_os = "SunOS";
$visitor['os'] = 'SunOS';
}
elseif(strpos($visitor['agent'], "OS/2"))
{
$visitor_os = "OS/2";
$visitor['os'] = 'OS/2';
}
elseif(strpos($visitor['agent'], "AIX"))
{
$visitor_os = "AIX";
$visitor['os'] = 'AIX';
}
elseif(preg_match("/(Bot|Crawl|Spider)/i", $visitor['agent']))
{
$visitor_os = "Spiders";
$visitor['os'] = 'Spiders';
}
else
{
$visitor_os = "其他";
$visitor['os'] = 'Other';
}
// AL8 首頁四格顯示 - END6. 修改 topicadmin.php
找
(是第一段約第 15 行那句)複製內容到剪貼簿
代碼:
require_once DISCUZ_ROOT.'./include/misc.func.php';下面添加複製內容到剪貼簿
代碼:
// AL8 首頁四格顯示 - START
require_once DISCUZ_ROOT.'./include/cache.func.php';
// AL8 首頁四格顯示 - END找複製內容到剪貼簿
代碼:
showmessage((isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed'), $resultarray['redirect']);在上面添加複製內容到剪貼簿
代碼:
// AL8 首頁四格顯示 - START
updatecache('newreply');
updatecache('newtopic');
// AL8 首頁四格顯示 - END7. 修改 logging.php
找複製內容到剪貼簿
代碼:
$sessionexists = 0;在下面添加複製內容到剪貼簿
代碼:
// AL8 首頁四格顯示 - START
require_once DISCUZ_ROOT.'./include/cache.func.php';
updatecache('todayvisit');
// AL8 首頁四格顯示 - END8. 修改 index.php
找複製內容到剪貼簿
代碼:
$catlist = $forumlist = $sublist = $pmlist = array();在上面添加複製內容到剪貼簿
代碼:
// AL8 首頁四格顯示 - START
if(!$statstatus && $discuz_uid) {
require_once DISCUZ_ROOT.'./include/counter.inc.php';
}
require_once DISCUZ_ROOT.'./include/misc.func.php';
$mem_home = convertip($onlineip, $datadir = "./");
require_once DISCUZ_ROOT.'./forumdata/cache/cache_todayvisit.php';
$todayvisit=$_DCACHE['todayvisit']['0']['COUNT(*)'] ;
@include './forumdata/cache/cache_newtopic.php';
@include './forumdata/cache/cache_newreply.php';
// AL8 首頁四格顯示 - END找複製內容到剪貼簿
代碼:
'forumlinks', 'birthdays', 'supe_updateusers'在後面插入複製內容到剪貼簿
代碼:
, 'foruminfo'9. 修改 register.php
找複製內容到剪貼簿
代碼:
$styleid = $styleid ? $styleid : $_DCACHE['settings']['styleid'];在下面添加複製內容到剪貼簿
代碼:
// AL8 首頁四格顯示 - START
$datecut = time() - (3600 * 24);
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}members WHERE regdate>='$datecut'");
$todaynewmems = $db->result($query, 0);
// AL8 首頁四格顯示 - END找複製內容到剪貼簿
代碼:
updatesettings();在上面添加複製內容到剪貼簿
代碼:
// AL8 首頁四格顯示 - START
$_DCACHE['settings']['todaynewmems'] = $todaynewmems;
// AL8 首頁四格顯示 - END10. 修改 discuz.htm
找到及刪除複製內容到剪貼簿
代碼:
<div id="announcement" onmouseover="if(!anncount) {clearTimeout(annst);annst = 0}" onmouseout="if(!annst) annst = setTimeout('announcementScroll()', anndelay);">
<div id="announcementbody"><ul>$announcements</ul></div>
</div>找複製內容到剪貼簿
代碼:
<div id="foruminfo">
<div id="userinfo">
<div id="nav">
<!--{if $supe['status']}--><a href="$supe[siteurl]" target="_blank">$supe['sitename']</a> - <!--{/if}-->
<!--{if $gid || !$discuz_uid}--><a href="$indexname">$bbname</a> <!--{else}--><a href="space.php?action=viewpro&uid=$discuz_uid" class="dropmenu" id="creditlist" onmouseover="showMenu(this.id)">$discuz_user</a> <!--{/if}-->
<!--{if $discuz_uid}-->
<!--{if $supe['status'] && $xspacestatus}-->
- <a href="$supe[siteurl]/?uid/$discuz_uid" target="_blank">{lang space}</a>
<!--{elseif $spacestatus}-->
- <a href="space.php?uid=$discuz_uid" target="_blank">{lang space}</a>
<!--{/if}-->
<!--{if $supe['status'] && !$xspacestatus}-->
- <a href="$supe[siteurl]/?uid/$discuz_uid" target="_blank">{lang space_upgrade_space}</a>
<!--{/if}-->
<!--{/if}-->
</div>
<p>
<!--{if $discuz_uid}-->
<!--{if $allowinvisible}-->{lang online_status}:
<span id="loginstatus"><!--{if !empty($invisible)}--><a href="member.php?action=switchstatus" onclick="ajaxget(this.href, 'loginstatus');doane(event);">{lang login_invisible_mode}</a><!--{else}--><a href="member.php?action=switchstatus" title="{lang login_switch_invisible_mode}" onclick="ajaxget(this.href, 'loginstatus');doane(event);">{lang login_normal_mode}</a><!--{/if}--></span>,
<!--{/if}-->
{lang your_lastvisit}: <em>$lastvisittime</em>
<!--{if !empty($google) && ($google & 1)}-->
<!--{else}--> <!--{/if}-->
<a href="search.php?srchfrom=$newthreads&searchsubmit=yes">{lang show_newthreads}</a>
<a href="member.php?action=markread" id="ajax_markread" onclick="ajaxmenu(event, this.id)">{lang mark_read}</a>
<!--{elseif !$passport_status}-->
<form id="loginform" method="post" name="login" action="logging.php?action=login&loginsubmit=true">
<input type="hidden" name="formhash" value="{FORMHASH}" />
<input type="hidden" name="cookietime" value="2592000" />
<input type="hidden" name="loginfield" value="username" />
<input type="text" id="username" name="username" size="15" maxlength="40" tabindex="1" value="{lang username}" onclick="this.value = ''" />
<input type="password" id="password" name="password" size="10" tabindex="2" onkeypress="if((event.keyCode ? event.keyCode : event.charCode) == 13) $('loginform').submit()" />
<button name="userlogin" type="submit" value="true">{lang login}</button>
</form>
<!--{/if}-->
</p>
</div>
<div id="forumstats">
<p>
{lang index_today}: <em>$todayposts</em>, {lang index_yesterday}: <em>$postdata[0]</em>, {lang index_maxday}: <em>$postdata[1]</em> <a href="digest.php">{lang digest}</a>
<!--{if $rssstatus}--><a href="rss.php?auth=$rssauth" title="{lang rss_subscribe_all}" target="_blank"><img src="images/common/xml.gif" alt="{lang rss_subscribe_all}" /></a><!--{/if}-->
</p>
<p>{lang index_threads}: <em>$threads</em>, {lang index_posts}: <em>$posts</em>, {lang index_members}: <em>$totalmembers</em>, {lang welcome_newmember} <cite><a href="space.php?username=$memberenc">$lastmember</a></cite></p>
</div>
<!--{if !empty($google) && ($google & 1)}-->
<div id="headsearch" style="clear: both">
<script type="text/javascript" src="forumdata/cache/google_var.js"></script>
<script type="text/javascript" src="include/javascript/google.js"></script>
</div>
<!--{/if}-->
</div>更換為複製內容到剪貼簿
代碼:
<!--{if empty($gid)}-->
{template foruminfo}
<!--{/if}-->10. 下載附件 foruminfo.rar 及解壓為 foruminfo.htm, 並執行
a. 根據自身討論區對下一段作出調整引用:
現 {lang register} 成為會員即獲贈現金 100 元
b. 上傳到 ./templates/default/ 目錄下
c. 如果修改時漏了 "更新快取"步驟, 可在 ./forumdata/cache/ 目錄下加回一個空白的 cache_todayvisit.php 檔案便可
~完成~
四格延伸應用系列
1. AL8 首頁四格 加入 圖片 SHOW
http://linux0911.no-ip.info/Discuz/thread-9943-1-1.html
2. AL8 首頁四格 加入 最多人瀏覽
http://linux0911.no-ip.info/Discuz/thread-9944-1-1.html
3. AL8 首頁四格 加入 今日發文
http://linux0911.no-ip.info/Discuz/thread-9945-1-1.html
FAQ引用:
引用:
問題:
如何在 "最新發表文章" 及 "最新回覆文章" 加上 "主題分類
修改 ./include/cache.func.php
找複製內容到剪貼簿
代碼:
case 'newtopic':
$table = 'threads t, cdb_forums f';
$cols = "t.tid, t.subject, t.author, t.dateline, t.views, t.replies, t.lastpost, t.lastposter, t.highlight, f.name";
$fids="填上不需要顯示發新帖區域的 fid 編號, 以逗號作分格, 最後一個不用加上逗號";//例如 "1,2,3";
$conditions = "WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid NOT IN ($fids) ORDER BY t.dateline DESC LIMIT 0, 11";
break;
case 'newreply':
$table = 'threads t, cdb_forums f';
$cols = "t.tid, t.subject, t.author, t.dateline, t.views, t.replies, t.lastpost, t.lastposter, t.highlight, f.name";
$fids="填上不需要顯示回帖區域的 fid 編號, 以逗號作分格, 最後一個不用加上逗號";//例如 "1,2,3";
$conditions = "WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid NOT IN ($fids) AND t.replies !=0 ORDER BY t.lastpost DESC LIMIT 0, 11";
break;更換為複製內容到剪貼簿
代碼:
case 'newtopic':
$table = 'threads t';
$cols = "t.tid, t.typeid, t.subject, t.author, t.dateline, t.views, t.replies, t.lastpost, t.lastposter, t.highlight, f.name, tt.name AS idname";
$fids="填上不需要顯示發新帖區域的 fid 編號, 以逗號作分格, 最後一個不用加上逗號";//例如 "1,2,3";
$conditions = "LEFT JOIN {$tablepre}threadtypes tt ON (tt.typeid=t.typeid) LEFT JOIN {$tablepre}forums f ON (f.fid=t.fid) WHERE t.fid<>'$fid' AND f.fid NOT IN ($fids) ORDER BY t.dateline DESC LIMIT 0, 11";
break;
case 'newreply':
$table = 'threads t';
$cols = "t.tid, t.typeid, t.subject, t.author, t.dateline, t.views, t.replies, t.lastpost, t.lastposter, t.highlight, f.name, tt.name AS idname";
$fids="填上不需要顯示回帖區域的 fid 編號, 以逗號作分格, 最後一個不用加上逗號";//例如 "1,2,3";
$conditions = "LEFT JOIN {$tablepre}threadtypes tt ON (tt.typeid=t.typeid) LEFT JOIN {$tablepre}forums f ON (f.fid=t.fid) WHERE t.fid<>'$fid' AND f.fid NOT IN ($fids) AND t.replies !=0 ORDER BY t.lastpost DESC LIMIT 0, 11";
break;找複製內容到剪貼簿
代碼:
$rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);更換為複製內容到剪貼簿
代碼:
$rthread['view_subject'] = $rthread[idname] ? cutstr( "[$rthread[idname]] $rthread[subject]",$hack_cut_str) : cutstr($rthread['subject'],$hack_cut_str);找複製內容到剪貼簿
代碼:
$nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);更換為複製內容到剪貼簿
代碼:
$nthread['view_subject'] = $nthread[idname] ? cutstr( "[$nthread[idname]] $nthread[subject]",$hack_cut_str) : cutstr($nthread['subject'],$hack_cut_str);在下次更新時 (或到後台->更新快取) 便會顯示
作者: Eric03 時間: 2007-10-26 12:02 PM
必定支持
作者: lsy 時間: 2007-10-26 05:26 PM
十卜
作者: sa 時間: 2007-10-26 07:49 PM
支持
作者: Georgetang 時間: 2007-10-26 11:08 PM
萬分感謝及支持
作者: andy330 時間: 2007-11-11 01:05 PM
Linux0911 大大:
請問我的論壇安裝了直排,還可以安裝此四格嗎?
作者: Linux0911 時間: 2007-11-11 03:50 PM
直排好像不影響這個四格, 修改 discuz.htm 即可
作者: e0925597266 時間: 2007-12-1 03:53 AM
位什麼我安裝完後 最新發表文章 跟最新回覆文章 的排列超亂
要怎樣才能排整齊?~
作者: Linux0911 時間: 2007-12-1 08:40 AM 標題: 回覆 8# e0925597266 的帖子
很好, 這個問題剛剛看到
修改 ./include/cache.func.php 的這段改成這個就可以了引用:
// AL8 首頁四格顯示 - START
case 'newreply':
$hack_cut_str = 26;
$new_reply_threadlist = array();
$rthread = array();
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
while($rthread = $db->fetch_array($query)){
$rthread['forumname'] = $rthread['name'];
$rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
$rthread['subject'] = cutstr($rthread['subject'],46);
$rthread['date']= gmdate('Y-n-j G:i', $rthread['dateline'] + 8 * 3600);
$rthread['lastreplytime']= gmdate('Y-n-j G:i', $rthread['lastpost'] + 8 * 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 = "<a href=\"redirect.php?tid=$rthread[tid]&goto=lastpost#lastpost\" title=\"論壇: $rthread[forumname]\r\n標題: $rthread[subject]\r\n作者: $rthread[author]\r\n發表時間: $rthread[date]\r\n瀏覽次數: $rthread[views] 次\r\n回覆: $rthread[replies] 次\r\n最後回覆: $rthread[lastreplytime]\r\n最後發表: $rthread[lastposter]\" $rthread[highlight]>$rthread[view_subject]</a><br />";
$data[] = array('content' => $new_reply_threadlist);
}
break;
case 'newtopic':
$hack_cut_str = 26;
$new_post_threadlist = array();
$nthread = array();
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
while($nthread = $db->fetch_array($query)){
$nthread['forumname'] = $nthread['name'];
$nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
$nthread['subject'] = cutstr($nthread['subject'],46);
$nthread['date']= gmdate('Y-n-j G:i', $nthread['dateline'] + 8 * 3600);
$nthread['lastreplytime']= gmdate('Y-n-j G:i', $nthread[lastpost] + 8 * 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[replies] ? "<a href=\"redirect.php?tid=$nthread[tid]&goto=lastpost#lastpost\" title=\"論壇: $nthread[forumname]\r\n標題: $nthread[subject]\r\n作者: $nthread[author]\r\n發表時間: $nthread[date]\r\n瀏覽次數: $nthread[views] 次 \r\n回覆: $nthread[replies] 次\r\n最後回覆: $nthread[lastreplytime]\r\n最後發表: $nthread[lastposter]\" $nthread[highlight] >$nthread[view_subject]</a><br />" : "<a href=\"redirect.php?tid=$nthread[tid]&goto=lastpost#lastpost\" title=\"論壇: $nthread[forumname]\r\n標題: $nthread[subject]\r\n作者: $nthread[author]\r\n發表時間: $nthread[date]\r\n瀏覽次數: $nthread[views] 次\r\n回覆: 暫時沒有回覆\" $nthread[highlight] >$nthread[view_subject]</a><br />";
$data[] = array('content' => $new_post_threadlist);
}
break;
// AL8 首頁四格顯示 - END
作者: e0925597266 時間: 2007-12-1 10:19 AM
成功了!!~真的是太感謝你了...真的非常感謝你...!!!~整齊多了
作者: lamkee 時間: 2008-2-24 02:24 PM
有冇大大可以整完上載
作者: Mr.Q 時間: 2008-3-15 11:27 PM
如何刪除用戶登錄/論壇資料部份?
不太有用…
想完整刪除(不是只刪除 foruminfo 那頁而已)
請幫忙
作者: Linux0911 時間: 2008-3-16 12:14 AM 標題: 回覆 12# Mr.Q 的帖子
兩個欄位沒用到就直接將 foruminfo 的兩欄刪除複製內容到剪貼簿
代碼:
<td style="width: 25%">
<!--{if $discuz_uid}-->
<h4 style="font-size: 12pt"><a href="viewpro.php?uid=$discuz_uid" style="font-weight: bold; font-size: 12pt; color: #ca0000" title="查看 $discuz_userss 個人{lang view_profile}">$discuz_userss</a> <!--{if $allowinvisible}--><!--{if !empty($invisible)}--><a href="member.php?action=switchstatus" title="{lang login_switch_normal_mode}" style="color: blue">[{lang login_invisible_mode}]</a><!--{else}--><a href="member.php?action=switchstatus" title="{lang login_switch_invisible_mode}" style="color: green">[{lang login_normal_mode}]</a><!--{/if}--><!--{/if}--></h4>
<!--{else}-->
<h4 style="font-size: 11pt">請立即 <a href="register.php" style="color: red;">{lang register}</a>
成為 $bbname {lang memberlist}</h4>
<!--{/if}-->
<table cellspacing="0" cellpadding="0">
<!--{if $discuz_uid}-->
{lang index_status}:<span style="font-weight: bold"><!--{if $validdays}--><a href="member.php?action=groupexpiry"><span style="font-weight: bold">$grouptitle</span>($validdays)</a><!--{else}--><span style="font-weight: bold">$grouptitle</span><!--{/if}--></span>
{lang lastvisit}: <span style="font-weight: bold">$lastvisittime</span>
{lang credits}: <span style="font-weight: bold">$credits</span>
<!--{loop $extcredits $id $credit}-->
$credit[title]: <span style="font-weight: bold">$GLOBALS[extcredits.$id]</span> $credit[unit]
<!--{/loop}-->
IP:<span style="font-weight: bold">$onlineip</span>
{lang location}:<span style="font-weight: bold">$mem_home</span>
作業系統:<span style="font-weight: bold"><font face="Verdana">$visitor_os</font></span>
{lang stats_browser}:<span style="font-weight: bold"><font face="Verdana">$visitor_browser</font></span>
新{lang pm}:<a href="pm.php" target=_bank>
<!--{if $newpm ==0}-->沒有新{lang pm}<!--{else}-->
共<span style="font-weight: bold"> $newpmnum</span> 條</a><!--{/if}-->
<a href="search.php?srchfrom=$newthreads&searchsubmit=yes" title="{lang show_newthreads}">新帖</a> |
<a href="member.php?action=markread" title="{lang mark_read}">標讀</a> | <a href="my.php?item=threads" title="{lang show_mytopics}">我帖</a> | <a href="digest.php" title="{lang digest}">精華</a> | <!--{if $allowuseblog}--><a href="blog.php?uid=$discuz_uid" target="_blank" title="我的{lang blog}">{lang blog}</a>
<!--{/if}-->
<!--{else}--> <form method="post" name="login" action="logging.php?action=login&">
<input type="hidden" name="formhash" value="{FORMHASH}" />
<input type="hidden" name="referer" value="$referer" />
來自 <span style="font-weight: bold; color: blue;">$mem_home</span> 的訪客
現 {lang register} 成為會員即獲贈現金 100 元
做為參與本討論區的活動之用。
<span style="font-weight: bold; color: green"><a href="index.php" style="color: green">$bbname</a> {lang member_login}</span>
{lang username}:<input type="text" id="username" name="username" size="15" maxlength="40" tabindex="4" title="填入用戶名稱登錄" />
{lang password} :<input type="password" id="password" name="password" size="15" tabindex="5" title="填入用戶密碼登錄" />
<button class="submit" type="submit" name="loginsubmit" value="true" tabindex="100" title="填寫帳號密碼即可登錄{LF}未註冊者請先註冊">登錄</button>
</form>
<form method="post" name="login" action="$link_login">
或使用 <a href="$link_login" title=""><input type="submit" id="postsubmit" value="安全登錄" title="進階登錄" tabindex="4" /></a>
</form>
<!--{/if}-->
</table>
</td>那其它欄位那個 % 數依自己需求調整~
作者: Mr.Q 時間: 2008-3-16 01:21 AM 標題: 回覆 13# Linux0911 的帖子
整好了!
如何消除粗體(當設置主題粗體時)?
我知道3步那種首頁四格的更改方法
可是al8的應該不太一樣..
想請問一下!
只刪除粗體(高亮不刪除!)
謝謝

| 歡迎光臨 Linux0911 Forum (http://linux0911.no-ip.info/Discuz/) |
Powered by Discuz! 6.0.0 |