Resource icon

Different style per domain (code example) 1.x

No permission to download
I made this simple addon to override the style choice by domain name. You need to edit the library/StyleOverride/Listen.php file to specify the domains and their style_ids:

Rich (BB code):
<?php

class StyleOverride_Listen
{
	public static function listen(XenForo_Controller $controller, $action)
	{
		$visitor = XenForo_Visitor::getInstance();
		$host = $controller->getRequest()->getServer('HTTP_HOST');

		if ($host == 'www.domain1.com')
		{
			$visitor['style_id'] = 3;
		}
		else if ($host == 'www.domain2.com')
		{
			$visitor['style_id'] = 2;
		}
		// DEFAULT STYLEID, IF NONE OF THE DOMAINS MATCH
		else
		{
			$visitor['style_id'] = 3;
		}
	}
}
Also, all of the style_ids you set must be user-selectable:

Screen shot 2011-12-13 at 9.09.39 PM.png

Of course this code can be changed to use any other conditions you wish.
Author
Jake Bunce
Downloads
76
First release
Last update
Rating
5.00 star(s) 3 ratings

More resources from Jake Bunce

Latest reviews

Works like a charm on 1.3.1
Actually CRDeveloper has a great point :) I was trying to suss out the usage of this.. but yes weel done :) TY
Good for mobile redirection!!!
Top