MyBB Community Forums

Full Version: Is this possible? Question about loading different themes...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

Is it possible for a guest/non-logged-in-member to see a different forum theme/skin for the same forum depending on where they enter from?
For example:
-Enter http://community.mybboard.net/ from a link at http://www.mybboard.com/site_a/ and it loads one theme/skin.
-Enter http://community.mybboard.net/ from a link at http://www.mybboard.com/site_b/ and it loads a different theme/skin.

Hopefully this makes sense.
Since you have to set a default forum skin, I kind of doubt this is possible... but that's why I'm asking. Wink I don't know enough about this stuff to know one way or another.

Thanks for any help you can give!
If i have understood your right, no it is not possible as far as i know.

However in case you want each forum to have a unique theme, different that the default or this you are using on the index of your board, you can set a theme for each forum, from the forum management, by editing the forum and modify the Style Options.

regards
Well sure it is possible, however you would need to make an php code for that, and well I don't really see why you want it.
Re: Zaher
Hmm, maybe that's what I'll have to do... but it would be cool if there is a way to do it like CraKteR suggests.

Re: CraKteR
I want to do it because I already have an established site and forum, but will be developing another site soon that I want to use the same forum with (but with a different theme when you enter from it, so people don't think they've gone somewhere completely different, with a different color scheme/etc).
Hopefully that makes sense.

Thanks.
Okey, I just made an little script for this.
Go to global.php
find:
if(!$loadstyle)
{
	$loadstyle = "def='1'";
}
Replace with:
if(!$loadstyle)
{
	$path = "/forum"; // Change to the directoryname of the site you want it to have another theme on. Change to "forum." if it's an subdomain.
	$styletid = "3"; // Theme ID of the Theme you want to show on the other page.
	if(strpos(strtolower($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']), $path) !== false) {
		$loadstyle = "tid='".$styletid."'";
	} else {
		$loadstyle = "def='1'";
	}
}

It should work, tested an little script on my page. not my forum though.
So $path = "/forum"; would turn into $path = "/site_b"; then? And that will make it so that if someone enters ../forum from /site_b, it will load $styletid = "3";?
I just want to make sure I understand that right, and that we are trying to do the same thing. ^^

Also, would the same code work if I were wanting to enter the forum (and see a different theme) from a different URL entirely? Such as making $path = "/forum"; into $path = "http://www.theothersite.com";?
I know very very little about PHP, so excuse the ignorance.

Thanks for your help! Big Grin
Appreciate it.

I'm unable to test any of this stuff out until a bit later tonight or tomorrow.
yes, $path = "/site_b" will change the theme to the style id 3.
Well if you want to have that you need to do something like this.
$path = "theothersite.com";
Since I didn't include http:// and adding www. isn't always that good since it is available on both. Smile
Ok, thanks much.
+rep to you. Wink

I'll let you know how it goes once I'm able to test it out.
No problem Smile
Yea, just shout if you need help/doesn't work as you wanted.
I don't think you want to check $_SERVER['SCRIPT_NAME'] (the path of the current script); instead use $_SERVER['REFERER'] (where you came from).
Pages: 1 2