Mit folgendem MOD kannst du das realisieren.
Du musst es halt so einstellen, das default-mässig alle Kategorien
eingerollt sind.
Die Einstellungen werden für jeden User individuell über Cookies
gespeichert. Verlässt also ein User deine Seite und sein 'lieblings'
Forum ist geöffnet, ist es das auch, wenn er das nächste Mal auf die
Seite kommt.
Code: Alles auswählen
##############################################################
## Mod Name: reduce_categories_v1_1_0.txt
## Mod Date: 2002-06-17
## Mod Title: Reduce Categories
## Mod Version: 1.1.0
## for phpBB Version: 2.0.1
## Author: Matthias C. Hormann <matthias@hormann-online.net>
## Description: some_description_goes_here
## Description: This mod allows persistent folding up (reducing) of
## categories on the main page to help users keep
## an overview on larger boards. It also changes the
## "view category" logic so that if you click on the
## cat title it will instead reduce/expand this category's
## view (as opposed to temporarily expanding this
## category and reducing all others).
##
## The MOD uses cookies to remember user's preferences,
## so cookies should be enabled in the user's browser.
##
## Categories that should be reduced by default (i.e.,
## before the user has probably chosen otherwise) can
## be set by beginning the category name with the string ":-:",
## i.e. ":-:Category reduced by default".
##
## Installation Level: Easy
## Installation Time: 5 Minutes
##
## Files To Edit: 4 (5)
## index.php
##
## The following need to be modified for every TEMPLATE you are using:
## templates/subSilver/subSilver.cfg
## templates/subSilver/index_body.tpl
##
## The following need to be modified for every LANGUAGE you are supporting:
## language/lang_english/lang_main.php
## language/lang_german/lang_main.php
##
## Included Files: 2
## templates/subSilver/images/icon_minus.gif
## templates/subSilver/images/icon_plus.gif
##############################################################
##############################################################
## For Security Purposes, This MOD Cannot Be Posted Or Added At Any Non-Official phpBB Site
##############################################################
##############################################################
## Author Note:
## ------------
##
## o This mod is EasyMod v0.4alpha compatible.
## o Best viewed when your editor's tab size is set to 4.
##
##
## Change Log:
## -----------
##
## o v1.1.0
## - Initial Release to the public, after several optimizations.
## - Includes English as well as German language mod.
## o v1.0.0
## - Internal release for testing only.
##
##############################################################
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY ]------------------------------------------
#
templates/subSilver/images/icon_minus.gif
templates/subSilver/images/icon_plus.gif
#
#-----[ OPEN ]------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------
#
// End session management
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
//
// MOD: Reduce Categories v1.1.0
//
if ( isset($HTTP_GET_VARS[POST_CAT_URL.'_expand']) )
{
// set cookie; expires in 1 year from now
setcookie($board_config['cookie_name'] . '_' . POST_CAT_URL . '_' . $HTTP_GET_VARS[POST_CAT_URL.'_expand'] . '_reduced', '0', (time() + 31536000), $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("index.$phpEx"));
}
if ( isset($HTTP_GET_VARS[POST_CAT_URL.'_reduce']) )
{
// set cookie; expires in 1 year from now
setcookie($board_config['cookie_name'] . '_' . POST_CAT_URL . '_' . $HTTP_GET_VARS[POST_CAT_URL.'_reduce'] . '_reduced', '1', (time() + 31536000), $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("index.$phpEx"));
}
//
// MOD: -END-
//
#
#-----[ FIND ]------------------------------------------
#
$template->assign_block_vars('catrow', array(
'CAT_ID' => $cat_id,
'CAT_DESC' => $category_rows[$i]['cat_title'],
'U_VIEWCAT' => append_sid("index.$phpEx?" . POST_CAT_URL . "=$cat_id"))
);
#
#-----[ REPLACE WITH ]------------------------------------------
#
//
// MOD: Reduce Categories v1.1.0
//
$reduce_by_default = ':-:'; // this string first in a category title denotices "reduce by default"
// check if this category should be reduced by default
if (substr($category_rows[$i]['cat_title'], 0, strlen($reduce_by_default)) == $reduce_by_default)
{
$cat_title = ltrim(substr($category_rows[$i]['cat_title'], strlen($reduce_by_default)));
$reduce_cat[$cat_id] = 1;
}
else
{
$cat_title = $category_rows[$i]['cat_title'];
$reduce_cat[$cat_id] = 0;
}
// now check if cookie set; use if so
if (isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_' . POST_CAT_URL . '_' . $cat_id . '_reduced']))
{
$reduce_cat[$cat_id] = $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_' . POST_CAT_URL . '_' . $cat_id . '_reduced'];
}
// build +/- icon link and ALT text
if ($reduce_cat[$cat_id] == 1)
{
$cat_reduced_url = append_sid("index.$phpEx?".POST_CAT_URL."_expand=$cat_id");
$cat_reduced_img = '<a href="' . $cat_reduced_url . '"><img src="' . $images['icon_plus'] . '" alt="' . $lang['Expand_this_category'] . '" title="' . $lang['Expand_this_category'] . '" border=0></a>';
}
else
{
$cat_reduced_url = append_sid("index.$phpEx?".POST_CAT_URL."_reduce=$cat_id");
$cat_reduced_img = '<a href="' . $cat_reduced_url . '"><img src="' . $images['icon_minus'] . '" alt="' . $lang['Reduce_this_category'] . '" title="' . $lang['Reduce_this_category'] . '" border=0></a>';
}
$template->assign_block_vars("catrow", array(
'CAT_ID' => $cat_id,
'CAT_DESC' => $cat_title,
'CAT_REDUCED_IMG' => $cat_reduced_img,
'U_CAT_REDUCED' => $cat_reduced_url,
'U_VIEWCAT' => append_sid("index.$phpEx?" . POST_CAT_URL . "=$cat_id"))
);
if ($reduce_cat[$cat_id] == 1)
{
continue;
}
//
// MOD: -END-
//
#
#-----[ OPEN ]------------------------------------------
#
# The following need to be modified for every TEMPLATE you are using:
#
templates/subSilver/subSilver.cfg
#
#-----[ FIND ]------------------------------------------
#
//
// Vote graphic length defines the maximum length of a vote result
#
#-----[ BEFORE, ADD ]------------------------------------------
#
//
// MOD: Reduce Categories v1.1.0
//
$images['icon_minus'] = "$current_template_images/icon_minus.gif";
$images['icon_plus'] = "$current_template_images/icon_plus.gif";
//
// MOD: -END-
//
#
#-----[ OPEN ]------------------------------------------
#
# The following need to be modified for every TEMPLATE you are using:
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<td class="catLeft" colspan="2" height="28"><span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></span></td>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<!-- MOD: Reduce Categories v1.1.0 -->
<td class="catLeft" colspan="2" height="28"><span class="cattitle">{catrow.CAT_REDUCED_IMG} <a href="{catrow.U_CAT_REDUCED}" class="cattitle">{catrow.CAT_DESC}</a></span></td>
<!-- MOD: -END- -->
#
#-----[ OPEN ]------------------------------------------
#
# The following need to be modified for every LANGUAGE you are supporting:
# (ENGLISH)
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!
#
#-----[ BEFORE, ADD ]------------------------------------------
#
//
// MOD: Reduce Categories v1.1.0
//
$lang['Expand_this_category'] = 'Expand this category';
$lang['Reduce_this_category'] = 'Reduce this category';
//
// MOD: -END-
//
#
#-----[ OPEN ]------------------------------------------
#
# The following need to be modified for every LANGUAGE you are supporting:
# (GERMAN)
#
language/lang_german/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!
#
#-----[ BEFORE, ADD ]------------------------------------------
#
//
// MOD: Reduce Categories v1.1.0
//
$lang['Expand_this_category'] = 'Diese Kategorie expandieren';
$lang['Reduce_this_category'] = 'Diese Kategorie reduzieren';
//
// MOD: -END-
//
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Benötigte Bilder:
[ externes Bild ]
[ externes Bild ]