(just translated/shorten into english)
Dr.Death wrote:[SNIPPET] Simple Header Image changer
What is it about?
You can manage forums, to dispaly an other header-image. (hard-coded, not with acp-management)
prosilver only
No Version, no download, no support
explanation:
why create some css-parts (for example in the styles/prosilver/theme/colours.css at the end)
- Code: Select all
/* LPI-Clan Header Images */
.lpi {
background-color: #363636;
background-image: url("{T_THEME_PATH}/images/tfc2.jpg");
background-repeat: no-repeat;
}
.lpi-news {
background-color: #363636;
background-image: url("{T_THEME_PATH}/images/tfc2_medic.jpg");
background-repeat: no-repeat;
}
.lpi-phpbb3 {
background-color: #363636;
background-image: url("{T_THEME_PATH}/images/tfc2_engineer.jpg");
background-repeat: no-repeat;
}
.lpi-fun {
background-color: #363636;
background-image: url("{T_THEME_PATH}/images/tfc2_hw_guy.jpg");
background-repeat: no-repeat;
}
.lpi-off-topic {
background-color: #363636;
background-image: url("{T_THEME_PATH}/images/tfc2_sniper.jpg");
background-repeat: no-repeat;
}
the Background-Images need to be placed in styles/prosilver/theme/images
Now we need to modify the styles/prosilver/template/overall_header.html, so the new images are used:
find
- Code: Select all
<div id="page-header">
<div class="headerbar">
replace with:
- Code: Select all
<div id="page-header">
<div class="headerbar {HEADER_IMAGE}">
Now there's the hardcoded part. you need to place your forum_ids here (one case {NUM}: for each, default is for all uncalled ones, case 0: is for all other pages)
open: includes/functions.php
find:
- Code: Select all
<?php // Which timezone?
$tz = ($user->data['user_id'] != ANONYMOUS) ? strval(doubleval($user->data['user_timezone'])) : strval(doubleval($config['board_timezone']));
after add:
- Code: Select all
// start switch forum image in header
$header_forum = request_var('f', 0);
switch ($header_forum)
{
case 0: // index.php, search.php, ....
$header_bg = 'lpi';
break;
case 1: // forum_id 1
case 10: // forum_id 10
$header_bg = 'lpi-news';
break; // break; if no more forum shall get this image
case 2: // forum_id 2
$header_bg = 'lpi-fun';
break;
case 3: // forum_id 3
$header_bg = 'lpi-off-topic';
break;
case 25: // forum_id 25
case 26: // forum_id 26
case 27: // forum_id 27
$header_bg = 'lpi-phpbb3';
break;
default: // default for all other forums
$header_bg = 'lpi';
}
// end switch forum image in header
find
- Code: Select all
// The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array(
after add:
- Code: Select all
'HEADER_IMAGE' => $header_bg,
Clear cache in the ACP and refresh theme and template!

