RSimpson
06-07-2004, 04:40 PM
Hi folks,
I've written a small script using phpinclude_start which will replace images in the header code depending on which forum a user is currently browsing, thus allowing me to have a custom header on every forum and still allowing the user to select a dark or light style, liquid or fixed width.
Now this works great with the forum software as normal and I've begun an attempt to adapt it to work with vBadvanced CMPS. It still works fine on the board as normal but doesn't work at all on the CMPS pages, it just shows the default header. Here's the code for each part so you can have a look and see if you can spot where I'm going wrong, it should be a simple variable change.
phpinclude_start - template
// Example of how to include a seperate file:
ob_start();
require("/usr/home/username/public_html/forums/header-switcher.php");
$header = ob_get_contents();
ob_end_clean();
header - template
<a name="top"></a>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr height="116">
<td height="116" background="/forums/images/skin_specific/$skingfxdir/top_bg.gif">
<table width="100%" height="116" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="269"><img src="/forums/images/skin_specific/$skingfxdir/top_01.jpg" border="0" /><br /><a href="$vboptions[forumhome].php?$session[sessionurl]"><img src="/forums/images/skin_specific/$skingfxdir/logo.jpg" border="0" /></a></td>
<td width="269"><img src="/forums/images/skin_specific/$skingfxdir/top_02.jpg" border="0" /><br /><img src="/forums/images/skin_specific/$skingfxdir/top_03.jpg" border="0" /></td>
<td width="100%" style="background: url(/forums/images/skin_specific/$skingfxdir/top_right.jpg) 0px 0px no-repeat; text-align: right; vertical-align: bottom;"><img src="/forums/images/skin_specific/default/paec.gif" border="0" style="margin-right: 10px; margin-bottom: 12px;" /></td>
</tr>
</table></td>
</tr>
<tr height="18"><!-- menubar coming when site expands -->
<td height="18" background="/forums/images/skin_specific/default/menubar_bg.gif"></td>
</tr>
<tr height="100%">
<td height="100%">
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="10" valign="top"><img src="/forums/images/skin_specific/default/left_top.gif" border="0" /></td>
<td width="100%" style="background: #FFFFFF url(/forums/images/skin_specific/default/middle_topbg.gif) 0px 0px repeat-x;">
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td height="100%" valign="top">
$spacer_open
$_phpinclude_output
The script in the next piece of code replaces the variable $skingfxdir in the header template depending on the existance of $forumid and $action (which is my page variable in the CMPS).
header-switcher.php - file
<?php
// Main styles
$alt_rock = 'default/headers/alt_rock';
$punk = 'default/headers/alt_rock/punk';
$industrial_goth = 'default/headers/alt_rock/industrial_goth';
$metal = 'default/headers/alt_rock/metal';
$urban_hip_hop = 'default/headers/urban_hip_hop';
$dance_techno = 'default/headers/dance_techno';
$pop_mainstream = 'default/headers/pop_mainstream';
// Band styles
$cycle_of_zen = 'default/headers/bands_artists/cycle_of_zen';
if(($forumid == TRUE)&&($action == FALSE)) {
// Forum header switch
switch ($forumid) {
case 6:
$skingfxdir = $alt_rock;
break;
case 7:
$skingfxdir = $urban_hip_hop;
break;
case 8:
$skingfxdir = $dance_techno;
break;
case 9:
$skingfxdir = $pop_mainstream;
break;
case 24:
$skingfxdir = $punk;
break;
case 25:
$skingfxdir = $industrial_goth;
break;
case 26:
$skingfxdir = $metal;
break;
// Start band and artist headers
case 41:
$skingfxdir = $cycle_of_zen;
break;
// End band headers
default:
$skingfxdir = 'default';
break;
}
} else if(($forumid == FALSE)&&($action == TRUE)) {
// Portal header switch
switch ($action) {
case 'alt_rock':
$skingfxdir = $alt_rock;
break;
case 'punk':
$skingfxdir = $punk;
break;
case 'industrial_goth':
$skingfxdir = $industrial_goth;
break;
case 'metal':
$skingfxdir = $metal;
break;
case 'urban_hip_hop':
$skingfxdir = $urban_hip_hop;
break;
case 'dance_techno':
$skingfxdir = $dance_techno;
break;
case 'pop':
$skingfxdir = $pop_mainstream;
break;
default:
$skingfxdir = 'default';
break;
}
} else if(($forumid == FALSE)&&($action == FALSE)) {
$skingfxdir = 'default';
}
?>
If anybody can help me out the help would be greatly appreciated :)
Cheers,
Robert
I've written a small script using phpinclude_start which will replace images in the header code depending on which forum a user is currently browsing, thus allowing me to have a custom header on every forum and still allowing the user to select a dark or light style, liquid or fixed width.
Now this works great with the forum software as normal and I've begun an attempt to adapt it to work with vBadvanced CMPS. It still works fine on the board as normal but doesn't work at all on the CMPS pages, it just shows the default header. Here's the code for each part so you can have a look and see if you can spot where I'm going wrong, it should be a simple variable change.
phpinclude_start - template
// Example of how to include a seperate file:
ob_start();
require("/usr/home/username/public_html/forums/header-switcher.php");
$header = ob_get_contents();
ob_end_clean();
header - template
<a name="top"></a>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr height="116">
<td height="116" background="/forums/images/skin_specific/$skingfxdir/top_bg.gif">
<table width="100%" height="116" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="269"><img src="/forums/images/skin_specific/$skingfxdir/top_01.jpg" border="0" /><br /><a href="$vboptions[forumhome].php?$session[sessionurl]"><img src="/forums/images/skin_specific/$skingfxdir/logo.jpg" border="0" /></a></td>
<td width="269"><img src="/forums/images/skin_specific/$skingfxdir/top_02.jpg" border="0" /><br /><img src="/forums/images/skin_specific/$skingfxdir/top_03.jpg" border="0" /></td>
<td width="100%" style="background: url(/forums/images/skin_specific/$skingfxdir/top_right.jpg) 0px 0px no-repeat; text-align: right; vertical-align: bottom;"><img src="/forums/images/skin_specific/default/paec.gif" border="0" style="margin-right: 10px; margin-bottom: 12px;" /></td>
</tr>
</table></td>
</tr>
<tr height="18"><!-- menubar coming when site expands -->
<td height="18" background="/forums/images/skin_specific/default/menubar_bg.gif"></td>
</tr>
<tr height="100%">
<td height="100%">
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="10" valign="top"><img src="/forums/images/skin_specific/default/left_top.gif" border="0" /></td>
<td width="100%" style="background: #FFFFFF url(/forums/images/skin_specific/default/middle_topbg.gif) 0px 0px repeat-x;">
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td height="100%" valign="top">
$spacer_open
$_phpinclude_output
The script in the next piece of code replaces the variable $skingfxdir in the header template depending on the existance of $forumid and $action (which is my page variable in the CMPS).
header-switcher.php - file
<?php
// Main styles
$alt_rock = 'default/headers/alt_rock';
$punk = 'default/headers/alt_rock/punk';
$industrial_goth = 'default/headers/alt_rock/industrial_goth';
$metal = 'default/headers/alt_rock/metal';
$urban_hip_hop = 'default/headers/urban_hip_hop';
$dance_techno = 'default/headers/dance_techno';
$pop_mainstream = 'default/headers/pop_mainstream';
// Band styles
$cycle_of_zen = 'default/headers/bands_artists/cycle_of_zen';
if(($forumid == TRUE)&&($action == FALSE)) {
// Forum header switch
switch ($forumid) {
case 6:
$skingfxdir = $alt_rock;
break;
case 7:
$skingfxdir = $urban_hip_hop;
break;
case 8:
$skingfxdir = $dance_techno;
break;
case 9:
$skingfxdir = $pop_mainstream;
break;
case 24:
$skingfxdir = $punk;
break;
case 25:
$skingfxdir = $industrial_goth;
break;
case 26:
$skingfxdir = $metal;
break;
// Start band and artist headers
case 41:
$skingfxdir = $cycle_of_zen;
break;
// End band headers
default:
$skingfxdir = 'default';
break;
}
} else if(($forumid == FALSE)&&($action == TRUE)) {
// Portal header switch
switch ($action) {
case 'alt_rock':
$skingfxdir = $alt_rock;
break;
case 'punk':
$skingfxdir = $punk;
break;
case 'industrial_goth':
$skingfxdir = $industrial_goth;
break;
case 'metal':
$skingfxdir = $metal;
break;
case 'urban_hip_hop':
$skingfxdir = $urban_hip_hop;
break;
case 'dance_techno':
$skingfxdir = $dance_techno;
break;
case 'pop':
$skingfxdir = $pop_mainstream;
break;
default:
$skingfxdir = 'default';
break;
}
} else if(($forumid == FALSE)&&($action == FALSE)) {
$skingfxdir = 'default';
}
?>
If anybody can help me out the help would be greatly appreciated :)
Cheers,
Robert