PDA

View Full Version : seemingly complex phpinclude_start issue


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

Brian
06-07-2004, 05:14 PM
} else if(($forumid == FALSE)&&($action == TRUE)) {

Try changing this line to this:

} else if(!$forumid AND $action) {

Not sure if it will make a difference, but I didn't see anything too obvious in there.

Our Sponsors
 

RSimpson
06-07-2004, 05:29 PM
No difference :(

It might be a wild stab in the dark but is there any functions which need the variables used in the script made global? Or perhaps it's an issue with the page variable, what does the variable name end up as?


Cheers,
Robert

Brian
06-07-2004, 05:32 PM
There's nothing that I can think of that would make a difference... If you'd like to fill out a support ticket via the Members Area here then I'll be glad to take a look for you. I'm about to leave for the night though, so it would probably be tomorrow before I would be able to take a look.

Our Sponsors
 

RSimpson
06-07-2004, 05:34 PM
Where would I make a support ticket?


Cheers,
Robert

RSimpson
06-07-2004, 05:41 PM
Where would I make a support ticket?


Cheers,
Robertheh, ok I'm an idiot and didn't read your post properly.

RSimpson
06-07-2004, 05:55 PM
Just thinking about it there really isn't a lot of point in filling out a support ticket, all the code being used is posted here, anything else is already in the original CMPS code. I'll have a quick glance around the files to see if I can spot anything. :)


Cheers,
Robert

RSimpson
06-08-2004, 11:37 AM
I had a look around and the 1 variable I thought I might be able to use (the page request) didn't give me any joy :(

You haven't had a chance to get a look at it have you?


Cheers,
Robert

RSimpson
06-09-2004, 04:42 PM
I guess not then...

Brian
06-09-2004, 09:22 PM
As I said, if you'd like to submit a support ticket then I'll be glad to take a look. It would take a lot more time for me to copy those files and test it here than to just figure out what the problem is on your site.

RSimpson
06-11-2004, 08:45 AM
Sorry, I'll send 1 later tonight when I get home.