Log in

View Full Version : Different header depending on URL?


seraphi
11-13-2007, 12:12 PM
Hi guys,

I've been working on a forum today upgraded from a very old version (3.0.5) to the latest version (3.6.8 PL2). Now, on the old forum in the sytle manager there used to be a section called phpinclude_start and in this section I had the following code:

// Example of how to include a seperate file:

ob_start();

if (eregi(".co.uk",$_SERVER['SERVER_NAME']) {
include("ukheader.php");
} else {
include("usheader.php");
}

$header = ob_get_contents();
ob_end_clean();

ob_start();

if eregi(".co.uk",$_SERVER['SERVER_NAME']) {
include("ukfooter.php");
} else {
include("usfooter.php");
}

$footer = ob_get_contents();
ob_end_clean();

// Now place a reference to $your_code where you want the resulting HTML to be displayed.
// This will most likely be the header or footer template.


This allowed me to include my own custom headers and footers depending on which site the user was looking at; the .com or the .co.uk site.

However in the latest version that I've just upgraded to, it seems the phpinclude_start section of the style manager no longer exists and therefore my custom headers and footers are not working.

I've been reading through and found I might need to use plugins to do this, but does anybody have any pointers on how to do this?

Thanks in advance!

WhaLberg
11-13-2007, 12:31 PM
You need to add your codes to global_start hook as a plugin.

seraphi
11-13-2007, 01:35 PM
Excellent, think i've got it now, thanks! :)