AGAMES 討論區
標題:
論壇版塊直排系統 v1.1 For DZ7
[打印本頁]
作者:
dlalden
時間:
2009-1-21 17:37:14
標題:
論壇版塊直排系統 v1.1 For DZ7
作者: ntf
修改: CK 極少量修改
插件名稱: 社區直排顯示 1.1
程序版本: Discuz! 7.0.0
原帖:
http://www.alan888.com/Discuz/thread-159765-1-1.html
演示:
http://discuz.ckfreehost.com/bc6
安裝方法:
1.先備份論壇
2.數據庫升級
進入 系統設置>>工具>>數據庫>>數據升級>>貼上sql數據>>提交
ALTER TABLE `cdb_forums` ADD `straightdisplay` SMALLINT( 1 ) NOT NULL DEFAULT '0';
複製代碼
3.上傳文件(附件中管理平台內的file)
4.修改 index.php & discuz.htm
找 index.php
unset($_DCACHE['announcements']);
複製代碼
下加
// Edit by ntf Start
$showforumlist=empty($_GET['showforumlist']) ? $_DCOOKIE['showforumlist'] : addslashes($_GET['showforumlist']);
if(!$_DCOOKIE['showforumlist'] or ($_DCOOKIE['showforumlist']!=$showforumlist)){
$sdsetcookie =!empty($showforumlist) ? $showforumlist : 'straightdisplay';
dsetcookie('showforumlist', $sdsetcookie ,$timestamp+3600000);
$_DCOOKIE['showforumlist']=$sdsetcookie;
$showforumlist=$sdsetcookie;
}
if($showforumlist=='straightdisplay'){
require_once './forumdata/cache/plugin_straightdisplay.php';
$display_one = $_DPLUGIN['straightdisplay']['vars']['display_one'];
$display_two= $_DPLUGIN['straightdisplay']['vars']['display_two'];
$display_three= $_DPLUGIN['straightdisplay']['vars']['display_three'];
$display_four= $_DPLUGIN['straightdisplay']['vars']['display_four'];
$sql = !empty($accessmasks) ?
"SELECT f.straightdisplay,f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.todayposts, f.lastpost, f.inheritedmod, f.forumcolumns, f.simple, ff.description, ff.moderators, ff.icon, ff.viewperm, a.allowview FROM {$tablepre}forums f
LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid
LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid
WHERE f.status>0 ORDER BY f.type, f.displayorder"
: "SELECT f.straightdisplay,f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.todayposts, f.lastpost, f.inheritedmod, f.forumcolumns, f.simple, ff.description, ff.moderators, ff.icon, ff.viewperm FROM {$tablepre}forums f
LEFT JOIN {$tablepre}forumfields ff USING(fid)
WHERE f.status>0 ORDER BY f.type, f.displayorder";
$query = $db->query($sql);
while($forum = $db->fetch_array($query)) {
$forumname[$forum['fid']] = strip_tags($forum['name']);
if($forum['type'] != 'group') {
$threads += $forum['threads'];
$posts += $forum['posts'];
$todayposts += $forum['todayposts'];
if($forum['type'] == 'forum') {
if(forum($forum)) {
$thissdvalue='catlistone';
switch($forum[straightdisplay]){
case'1':
$catlistone[$forum['fup']]['forums'][] = $forum['fid'];
$forum['orderid'] = $catlistone[$forum['fup']]['forumscount']++;
break;
case'2':
$catlisttwo[$forum['fup']]['forums'][] = $forum['fid'];
$forum['orderid'] = $catlisttwo[$forum['fup']]['forumscount']++;
break;
case'3':
$catlistthree[$forum['fup']]['forums'][] = $forum['fid'];
$forum['orderid'] = $catlistthree[$forum['fup']]['forumscount']++;
break;
case'4':
$catlistfour[$forum['fup']]['forums'][] = $forum['fid'];
$forum['orderid'] = $catlistfour[$forum['fup']]['forumscount']++;
break;
}
$forum['subforums'] = '';
$forumlist[$forum['fid']] = $forum;
}
} elseif(isset($forumlist[$forum['fup']])) {
$forumlist[$forum['fup']]['threads'] += $forum['threads'];
$forumlist[$forum['fup']]['posts'] += $forum['posts'];
$forumlist[$forum['fup']]['todayposts'] += $forum['todayposts'];
if($subforumsindex && $forumlist[$forum['fup']]['permission'] == 2 && !($forumlist[$forum['fup']]['simple'] & 16) || ($forumlist[$forum['fup']]['simple'] & 8)) {
$forumlist[$forum['fup']]['subforums'] .= '<li><a href="forumdisplay.php?fid='.$forum['fid'].'">'.$forum['name'].'</a></li>';
}
}
} else {
if(!isset($_COOKIE['discuz_collapse']) || strpos($_COOKIE['discuz_collapse'], 'category_'.$forum['fid']) === FALSE) {
$forum['collapseimg'] = 'collapsed_no.gif';
$collapse['category_'.$forum['fid']] = '';
} else {
$forum['collapseimg'] = 'collapsed_yes.gif';
$collapse['category_'.$forum['fid']] = 'display: none';
}
if($forum['moderators']) {
$forum['moderators'] = moddisplay($forum['moderators'], 'flat');
}
$forum['forumscount'] = 0;
switch($forum[straightdisplay]){
case'1':
$catlistone[$forum['fid']] = $forum;
break;
case'2':
$catlisttwo[$forum['fid']] = $forum;
break;
case'3':
$catlistthree[$forum['fid']] = $forum;
break;
case'4':
$catlistfour[$forum['fid']] = $forum;
break;
}
}
}
}else{
//Edit by ntf End
複製代碼
找
unset($catid, $category);
if(isset($catlist[0]) && $catlist[0]['forumscount']) {
$catlist[0]['fid'] = 0;
$catlist[0]['type'] = 'group';
$catlist[0]['name'] = $bbname;
$catlist[0]['collapseimg'] = 'collapsed_no.gif';
} else {
unset($catlist[0]);
}
複製代碼
下加
} //Edit by Ntf
複製代碼
打開 templates/ * /discuz.htm 其中*為所有存在的資料夾
找
<!--{loop $catlist $key $cat}-->
<!--{if $cat['forumscount']}-->
<div class="mainbox list">
<span class="headactions">
<!--{if $cat['moderators']}-->{lang forum_category_modedby}: $cat[moderators]<!--{/if}-->
<img id="category_$cat[fid]_img" src="{IMGDIR}/$cat[collapseimg]" title="{lang spread}" alt="{lang spread}" onclick="toggle_collapse('category_$cat[fid]');" />
</span>
<h3><a href="$indexname?gid=$cat[fid]">$cat[name]</a></h3>
<table id="category_$cat[fid]" summary="category$cat[fid]" cellspacing="0" cellpadding="0" style="$collapse['category_'.$cat[fid]]">
<!--{if !$cat['forumcolumns']}-->
<!--{loop $cat[forums] $forumid}-->
<!--{eval $forum=$forumlist[$forumid];}-->
<tbody id="forum$forum[fid]">
<tr>
<th$forum[folder]>
$forum[icon]
<div class="left">
<h2><a href="forumdisplay.php?fid=$forum[fid]" {if $forum[redirect]}target="_blank"{/if}>$forum[name]</a><!--{if $forum[todayposts] && !$forum['redirect']}--><em> ({lang index_today}: <strong>$forum[todayposts]</strong>)</em><!--{/if}--></h2>
<!--{if $forum[description]}--><p>$forum[description]</p><!--{/if}-->
<!--{if $forum['subforums']}--><p>{lang forum_subforums}: $forum['subforums']</p><!--{/if}-->
<!--{if $forum['moderators']}--><!--{if $moddisplay == 'flat'}--><p>{lang forum_moderators}: $forum[moderators]</p><!--{else}--><span class="dropmenu" id="mod$forum[fid]" onmouseover="showMenu(this.id)">{lang forum_moderators}</span><ul class="moderators popupmenu_popup" id="mod$forum[fid]_menu" style="display: none">$forum[moderators]</ul><!--{/if}--><!--{/if}-->
</div>
</th>
<td class="forumnums">
<!--{if $forum['redirect']}-->N/A<!--{else}--><em>$forum[threads]</em> / $forum[posts]<!--{/if}-->
</td>
<td class="forumlast">
<!--{if $forum['permission'] == 1}-->
{lang private_forum}
<!--{else}-->
<!--{if $forum['redirect']}-->
<a href="forumdisplay.php?fid=$forum[fid]">{lang url_link}</a>
<!--{elseif is_array($forum['lastpost'])}-->
<p><a href="redirect.php?tid=$forum[lastpost][tid]&goto=lastpost#lastpost">{echo cutstr($forum[lastpost][subject], 30)}</a></p>
<cite><!--{if $forum['lastpost']['author']}-->$forum['lastpost']['author']<!--{else}-->{lang anonymous}<!--{/if}--> - $forum[lastpost][dateline]</cite>
<!--{else}-->
{lang never}
<!--{/if}-->
<!--{/if}-->
</td>
</tr>
</tbody>
<!--{/loop}-->
<!--{else}-->
<tr class="narrowlist">
<!--{loop $cat['forums'] $forumid}-->
<!--{eval $forum=$forumlist[$forumid];}-->
<!--{if $forum['orderid'] && ($forum['orderid'] % $cat['forumcolumns'] == 0)}-->
</tr></tbody>
<!--{if $forum['orderid'] < $cat['forumscount']}-->
<tbody><tr>
<!--{/if}-->
<!--{/if}-->
<th width="$cat[forumcolwidth]"{$forum[folder]}>
<h2><a href="forumdisplay.php?fid=$forum[fid]" {if $forum[redirect]}target="_blank"{/if}>$forum[name]</a><!--{if $forum[todayposts]}--><em> ({lang index_today}: <strong>$forum[todayposts]</strong>)</em><!--{/if}--></h2>
<!--{if !$forum[redirect]}-->
<p>{lang forum_threads}: $forum[threads], {lang forum_posts}: $forum[posts]</p>
<!--{if $forum['permission'] == 1}-->
<p>{lang private_forum}
<!--{else}-->
<p>{lang forum_lastpost}:
<!--{if is_array($forum['lastpost'])}-->
<a href="redirect.php?tid=$forum[lastpost][tid]&goto=lastpost#lastpost" title="{echo cutstr($forum[lastpost][subject], 30)} {lang forum_lastpost_by} {if $forum['lastpost']['author']}$forum['lastpost']['authorusername']{else}{lang anonymous}{/if} ">$forum[lastpost][dateline]</a>
<!--{else}-->
{lang never}
<!--{/if}-->
</p>
<!--{/if}-->
<!--{else}-->
<p>{lang url_link}</p>
<!--{/if}-->
</th>
<!--{/loop}-->
$cat['endrows']
<!--{/if}-->
</table>
</div>
<!--{if !empty($insenz['vfstatus']) && $insenz['vfpos'] == 'rand' && $key == $rkey}--><script type="text/javascript" src="campaign.php?action=list"></script><!--{/if}-->
<!--{if $admode && empty($insenz['hardadstatus']) && !empty($advlist['intercat']) && ($advlist['intercat'][$key] = array_merge(($advlist['intercat'][0] ? $advlist['intercat'][0] : array()), ($advlist['intercat'][$key] ? $advlist['intercat'][$key] : array())))}--><div class="ad_column" id="ad_intercat_$key"><!--{echo $advitems[$advlist['intercat'][$key][array_rand($advlist['intercat'][$key])]]}--></div><!--{else}--><div id="ad_intercat_$key"></div><!--{/if}-->
<!--{/if}-->
<!--{/loop}-->
複製代碼
改為
<!--{if $gid || $showforumlist == 'default'}-->
{template forumlist_default}
<!--{elseif empty($gid) && $showforumlist == 'straightdisplay'}-->
{template forumlist_straightdisplay}
<!--{/if}-->
複製代碼
直排 / 橫排互換功能(如需要)
在顯示的位置上加
<!--{if $gid || $showforumlist == 'default'}-->
<a href="index.php?showforumlist=straightdisplay">變更為直排顯示</a>
<!--{elseif empty($gid) && $showforumlist == 'straightdisplay'}-->
<a href="index.php?showforumlist=default">變更為普通顯示</a>
<!--{/if}-->
複製代碼
5.插件導入數據(在附件內的 discuz_plugin_straightdisplay.txt)
6.更新直排數據
請變更/新增版塊後 到 社區直排管理平台系統 直接按 [提交] 更新
如果你不想設計 , 請直接上載附件內的 風格檔1 或 風格檔2
**修改論壇分區圖片**
如果選用風格一
**修改論壇分區圖片**
1.為每一個論壇分區設計圖片(可用 images/forum/logo.gif 修改)
2.更改檔案名稱gid(版塊id).gif,假設論壇分區的 id 是 9,檔案名稱 => gid9.gif
3.上傳論壇圖片 images/forum/*.*
如果選用風格二
1.為每一個論壇分區設計圖片(可用 images/forum/title_blue_notext.jpg 修改)
2.更改檔案名稱title_(版塊id).jpg,假設論壇分區的 id 是 9,檔案名稱 => title_9.jpg
3.上傳論壇圖片 images/forum/*.*
作者:
jack1990125
時間:
2009-2-14 00:18:00
我想問 選用風格一 可以用jpg嗎~??
我改左forumlist_straightdisplay.htm 都唔得...
作者:
dlalden
時間:
2009-2-14 10:39:44
標題:
回覆 2樓 jack1990125 的帖子
唔可以!要用gif!
你想既話!不如用
風格二!可以用jpg
又「令」又好睇!
歡迎光臨 AGAMES 討論區 (http://forum.agames.hk/)
Powered by Discuz! X2