PDA

View Full Version : Mini-hack: Ability for Style Override on ANY vB-powered page


KuraFire
02-01-2004, 10:00 PM
Searching around, I couldn't find a way to get any page that wasn't a thread/forum based page to have a style override. So what happens then if you have, for instance, a fixed width layout and a liquid layout but you want the FAQ to always be fixed width, regardless of the user's chosen style, and the Memberlist to always be liquid?

Well, here's how to make that possible.

It's really simple, open up ./global.php and find this code (line 265 unhacked RC3):

// ################################################## ###########################
// if user can control panel, allow selection of any style (for testing purposes)
// otherwise only allow styles that are user-selectable

Add DIRECTLY ABOVE that:


// [START HACK='Allow Style override on Any page' AUTHOR='KuraFire' VERSION='1.00' CHANGEID= 1 ]
if (defined('OVERWRITE_STYLEID'))
{
$styleid = intval(OVERWRITE_STYLEID);
}
// [END HACK='Allow Style override on Any page' AUTHOR='KuraFire' VERSION='1.00' CHANGEID= 1 ]



Now, if you wish for a certain style to override on a certain page, use this in that page's .php file above the require_once('./global.php'); line:

define('OVERWRITE_STYLEID', 1);

where 1 is the styleid of the style you wish to use on that page.

That's all. Now you can enforce any style on any page, regardless of usersetting. Works on non-vB pages too, as long as you're using the vB engine for the templates of your page. :)

Zachery
02-02-2004, 09:11 AM
nice work kura :)

KuraFire
02-02-2004, 09:23 AM
it's so simple I'm amazed that this wasn't actually possible in vB3 itself already.. :D

gmarik
02-02-2004, 03:54 PM
nice and easy

KuraFire
02-03-2004, 03:11 PM
psst, you forgot handy ;)

Boofo
02-03-2004, 03:57 PM
Nice, easy, handy AND well done! ;)

KuraFire
02-03-2004, 04:38 PM
Hehe, thanks, glad you like :)

Boofo
02-03-2004, 04:41 PM
Mind if I post it in my how-to area giving you full credit? ;)

KuraFire
02-03-2004, 07:23 PM
not at all, but if other people are gonna implement it on their boards, they ought to hit that Install button over there ;)

Boofo
02-03-2004, 07:45 PM
LOL I don't have an install button. Never figured out how to set it up like they did here. ;)

KuraFire
02-03-2004, 08:03 PM
tsk, they should register here of course! ;)

kyk0
05-05-2004, 11:01 AM
Great mod! Installed.

Floris
05-05-2004, 11:06 AM
Great mod! Installed.
Oh you! ..

But yeah, nice little tweak.

Tony G
05-05-2004, 12:28 PM
Thought I might just join the crowd - nice mod Kura. Very handy. :)

Zachery
09-08-2004, 10:46 PM
Thought I might just join the crowd - nice mod Kura. Very handy. :)
Almost forgot this thing exsisted :)

Zachariah
10-08-2004, 04:28 PM
I only get this to work if the member is loged in. As a guest I can only see the default style not the 'OVERWRITE_STYLEID'.

Zachariah
10-12-2004, 02:12 AM
To the other 7 that have installed this hack. Can you see the style you want if the user is not loged in?

CyberRanger
02-09-2007, 06:26 PM
To the other 7 that have installed this hack. Can you see the style you want if the user is not loged in?
hehe ... I realize this thread is two+ years old but I have the same problem. The hack works great if the user is logged in but guest see the default forum style instead of the style I specified.

Any ideas? Anyone?

Edit: this will do it: https://vborg.vbsupport.ru/showpost.php?p=570343&postcount=3. I've combined the two methods for more flexibility. Hmmm ... I could make this a little plugin ver vb3.5 and up. :-)