Standard-Styles für Unterforen ?

Alles zu Styles, Templates, Icons und Smilies für phpBB 2.0, sowie allgemeine Designfragen zur Integration von phpBB in bestehende Websites.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
Tino
Mitglied
Beiträge: 60
Registriert: 04.11.2002 17:10

Standard-Styles für Unterforen ?

Beitrag von Tino »

So, kaum hab ich ein Problem gelöst, brauch ich auch schon wieder einen neuen Mod :D

Ich bräuchte einen Hack, der es mir erlaubt, für jedes Unterforum einen Standard-Style einzustellen. Normalerweise geht dies ja nur für das gesamte Forum. Gibt es einen solchen Hack und wenn ja, wie heißt der und wo krieg ich den her ? Wenn möglich, sollte er auf deutsch beschrieben sein, muss er aber nicht zwingend.
Tino
Mitglied
Beiträge: 60
Registriert: 04.11.2002 17:10

Beitrag von Tino »

Kann mir keiner helfen ?
Benutzeravatar
Simpson
Ehemaliges Teammitglied
Beiträge: 1088
Registriert: 20.05.2002 17:35
Wohnort: Göttingen
Kontaktdaten:

Beitrag von Simpson »

Code: Alles auswählen

##############################################################
## MOD Title: Forum Style mod
## MOD Author: metalcrypt < michelr@metalcrypt.com > (Michel Renaud) http://metalcrypt.bravepages.com
## MOD Description: This mod lets you select a separate style for each forum
## MOD Version: 1.0.1
##
## Installation Level: Easy
## Installation Time: 10 Minutes
## Files To Edit:    4
##   phpBB2/language/lang_xx/lang_admin.php 
##   phpBB2/includes/functions.php 
##   phpBB2/templates/template_dirXX/admin/forum_edit_body.tpl
##   phpBB2/admin/admin_forums.php
##   phpBB2/posting.php
##   phpBB2/includes/topic_review.php
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://metalcrypt.bravepages.com for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum.
##############################################################
## Author Notes:
##
## Revision history:
##
## 1.0.1 (August 16, 2002): Fixes wrong style used when replying/editing/quoting
##	Note: Upgrade from 1.0.0 by modifying the last 2 files (posting.php, topic_review.php)
## 1.0.0 (August 8, 2002): Initial release
##
## This mod is for phpBB2 ver 2.0.1 (no report of it not working under 2.0.2, but not officially tested)
##
## If you are using a prefix to you DB tabels then you have to add this to 
## the SQL commands, e.g. "phpbb_users" instead of just "users" - ONLY 
## in the initial SQL commands, not in the php code ! 
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
############################################################## 

# 
#-----[ ADD SQL ]------------------------------------------ 
# 
ALTER TABLE forums ADD forum_style smallint(5);  


# 
#-----[ OPEN FILE:  phpBB2/language/lang_xx/lang_admin.php  ]------------------------------------------ 
# 
#  (make sure to edit this file for every language your board uses). 

# 
#-----[ FIND 357]------------------------------------------ 
# 
$lang['Forum_status'] = 'Forum status';

# 
#-----[ ADD AFTER ]------------------------------------------ 
# 
$lang['Forum_style'] = 'Forum style';
$lang['Forum_default_style'] = 'Default board style';


# 
#-----[ SAVE FILE:  phpBB2/language/lang_XX/lang_admin.php ]------------------------------------------ 
# 

# 
#-----[ OPEN FILE:  phpBB2/includes/functions.php ]------------------------------------------ 
#  

# 
#-----[ FIND 197 ]------------------------------------------ 
# 
global $board_config, $theme, $images;

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
global $board_config, $theme, $images, $db, $forum_id;

# 
#-----[ FIND 238]------------------------------------------ 
# 
	if ( !$board_config['override_user_style'] )
	{
		if ( $userdata['user_id'] != ANONYMOUS && $userdata['user_style'] > 0 )
		{
			if ( $theme = setup_style($userdata['user_style']) )
			{
				return;
			}
		}
	}

	$theme = setup_style($board_config['default_style']);


# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 

	if (!empty($forum_id))
	{
		$sql = "SELECT forum_style
			FROM " . FORUMS_TABLE . "
			WHERE forum_id = $forum_id";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(CRITICAL_ERROR, 'Could not query database for forum info');
		}
		
		if ( !($row = $db->sql_fetchrow($result)) )
		{
			message_die(CRITICAL_ERROR, "Could not extract theme data for forum_id [$forum_id]");
		}

		if (!empty($row['forum_style']))
			$theme = setup_style($row['forum_style']);
		else
			$theme = setup_style($board_config['default_style']);
	}
	else
	{
		if ( !$board_config['override_user_style'] )
		{
			if ( $userdata['user_id'] != ANONYMOUS && $userdata['user_style'] > 0 )
			{
				if ( $theme = setup_style($userdata['user_style']) )
				{
					return;
				}
			}
		}
	
		$theme = setup_style($board_config['default_style']);
	}
# 
#-----[ SAVE FILE:  phpBB2/includes/functions.php ]------------------------------------------ 
# 

# 
#-----[ OPEN FILE:  phpBB2/admin/admin_forums.php ]------------------------------------------ 
#  

# 
#-----[ FIND 124 ]------------------------------------------ 
# 
function get_list($mode, $id, $select)
{
	global $db;
	

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
function get_list($mode, $id, $select)
{
	global $db, $lang;

# 
#-----[ FIND 92 ]------------------------------------------ 
# 
		default:
			message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__);
			break;

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
		case 'theme':
			$table = THEMES_TABLE;
			$idfield = 'themes_id';
			$namefield = 'style_name';
			break;

# 
#-----[ FIND 156 ]------------------------------------------ 
#
		message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums", "", __LINE__, __FILE__, $sql);

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
		message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums/Styles", "", __LINE__, __FILE__, $sql);


# 
#-----[ FIND 159]------------------------------------------ 
#
	$cat_list = "";

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
	//
	// Add a "default style" choice to the list of styles
	//
	if ($mode == 'theme')
	{
		$s = "";

		if ($id == NULL)
		{
			$s = " selected=\"selected\"";
		}
		$catlist .= "<option value=\"NULL\"$s>" . $lang['Forum_default_style'] . "</option>\n";
	}
	else
	{
		$cat_list = "";
	}

# 
#-----[ FIND 289]------------------------------------------ 
#
				$forumstatus = $row['forum_status'];

# 
#-----[ ADD AFTER ]------------------------------------------ 
# 
				$theme_id = $row['forum_style'];

# 
#-----[ FIND 325]------------------------------------------ 
#
			$catlist = get_list('category', $cat_id, TRUE);

# 
#-----[ ADD AFTER ]------------------------------------------ 
# 
			$forumlist = get_list('theme', $theme_id, TRUE);

# 
#-----[ FIND 344]------------------------------------------ 
#
				'S_PRUNE_ENABLED' => $prune_enabled,			

# 
#-----[ ADD AFTER ]------------------------------------------ 
# 
				'S_STYLE_LIST' => $forumlist,

# 
#-----[ FIND ]------------------------------------------ 
#
				'L_DAYS' => $lang['Days'],
				
				regner med at han mener prune days eller noe sånt

# 
#-----[ ADD AFTER ]------------------------------------------ 
# 
				'L_FORUM_STYLE' => $lang['Forum_style'],
			
# 
#-----[ FIND 414]------------------------------------------ 
#
			// There is no problem having duplicate forum names so we won't check for it.
			$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
				VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
			$forumstyle = intval($HTTP_POST_VARS['forumstyle']);

			if ($forumstyle == 0)
				$forumstyle = "NULL";


			// There is no problem having duplicate forum names so we won't check for it.
			$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ", forum_style)
				VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ", " . $forumstyle . ")";

# 
#-----[ FIND 460]------------------------------------------ 
#
			$sql = "UPDATE " . FORUMS_TABLE . "
				SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
				WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#


			$forumstyle = intval($HTTP_POST_VARS['forumstyle']);

			if ($forumstyle == 0)
				$forumstyle = "NULL";

			$sql = "UPDATE " . FORUMS_TABLE . "
				SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . ", forum_style = " . $forumstyle .
				" WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);


# 
#-----[ SAVE:  phpBB2/admin/admin_forums.php ]------------------------------------------ 
#  

# 
#-----[ OPEN FILE:  phpBB2/templates/template_dirXX/admin/forum_edit_body.tpl ]------------------------------------------ 
# 

# 
#-----[ FIND ]------------------------------------------ 
# 
	<tr> 
	  <td class="row1">{L_FORUM_STATUS}</td>
	  <td class="row2"><select name="forumstatus">{S_STATUS_LIST}</select></td>
	</tr>

# 
#-----[ ADD AFTER ]------------------------------------------ 
# 
	<tr> 
	  <td class="row1">{L_FORUM_STYLE}</td>
	  <td class="row2"><select name="forumstyle">{S_STYLE_LIST}</select></td>
	</tr>

# 
#-----[ SAVE:  phpBB2/templates/template_dirXX/admin/forum_edit_body.tpl ]------------------------------------------ 
#  

# 
#-----[ OPEN FILE:  phpBB2/posting.php ]------------------------------------------ 
# 

# 
#-----[ FIND 227 ]------------------------------------------ 
# 
	$forum_id = $post_info['forum_id'];
	
# 
#-----[ ADD AFTER ]------------------------------------------ 
# 

	//
	// Set up style 
	//
	if (!empty($forum_id))
	{
		$sql = "SELECT forum_style
			FROM " . FORUMS_TABLE . "
			WHERE forum_id = $forum_id";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(CRITICAL_ERROR, 'Could not query database for forum info');
		}
		
		if ( !($row = $db->sql_fetchrow($result)) )
		{
			message_die(CRITICAL_ERROR, "Could not extract theme data for forum_id [$forum_id]");
		}

		if (!empty($row['forum_style']))
			$theme = setup_style($row['forum_style']);
		else
			$theme = setup_style($board_config['default_style']);
	}
	else
		$theme = setup_style($board_config['default_style']);

# 
#-----[ SAVE:  phpBB2/templates/posting.php ]------------------------------------------ 
#  

# 
#-----[ OPEN FILE:  phpBB2/includes/topic_review.php ]------------------------------------------ 
# 

# 
#-----[ FIND 26 ]------------------------------------------ 
# 
	global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
	
# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
	global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path, $forum_id;
	
# 
#-----[ SAVE:  phpBB2/includes/topic_review.php ]------------------------------------------ 
#  

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM 
Antworten

Zurück zu „phpBB 2.0: Styles, Templates und Grafiken“