一般的默认情况下,论坛的首页的版块都是打开的。如图:
但是如果在版块内容比较多的情况下,我们想让版块自动收缩起来怎么办呢?对于这个打开收缩的功能,在discuz中是通过$_G['cookie'] ['collapse']这个来控制的,我们想达到默认收缩的目的只要找到source/module/forum/forum_index.php文 件,把513-532行这段代码:
foreach($catlist as $fid => $forum) {
if(!isset($_G['cookie']['collapse']) || strpos($_G['cookie']['collapse'], '_category_'.$fid.'_') === FALSE) {
$catlist[$fid]['collapseimg'] = 'collapsed_no.gif';
$collapse['category_'.$fid] = '';
} else {
$catlist[$fid]['collapseimg'] = 'collapsed_yes.gif';
$collapse['category_'.$fid] = 'display: none';
}
}
for($i = -2; $i <= 0; $i++) {
if(!isset($_G['cookie']['collapse']) || strpos($_G['cookie']['collapse'], '_category_'.$i.'_') === FALSE) {
$collapse['collapseimg_'.$i] = 'collapsed_no.gif';
$collapse['category_'.$i] = '';
} else {
$collapse['collapseimg_'.$i] = 'collapsed_yes.gif';
$collapse['category_'.$i] = 'display: none';
}
}
}
修改为:
foreach($catlist as $fid => $forum) {
if(!isset($_G['cookie']['collapse']) || strpos($_G['cookie']['collapse'], '_category_'.$fid.'_') === FALSE) {
$catlist[$fid]['collapseimg'] = 'collapsed_yes.gif';
$collapse['category_'.$fid] = 'display: none';
} else {
$catlist[$fid]['collapseimg'] = 'collapsed_no.gif';
$collapse['category_'.$fid] = '';
}
}
for($i = -2; $i <= 0; $i++) {
if(!isset($_G['cookie']['collapse']) || strpos($_G['cookie']['collapse'], '_category_'.$i.'_') === FALSE) {
$collapse['collapseimg_'.$i] = 'collapsed_yes.gif';
$collapse['category_'.$i] = 'display: none';
} else {
$collapse['collapseimg_'.$i] = 'collapsed_no.gif';
$collapse['category_'.$i] = '';
}
}
}
即可
此文由 网站目录_网站网址收录与提交入口 编辑,未经允许不得转载!: