How can we get custom pages to pull a custom child style?
|
Quote:
|
Quote:
Each forum section on my site uses its own template set, I would like to utilize the different styles in the respected off forum sections. green widget forum= green widget style= I want to use this style in my green widgets tutorials which are integrated using the methods explained in this thread. red blue yellow |
Quote:
I looked in to this and can't find a really good way to do it. You could create a plugin using hook global_bootstrap_init_start, check for your value of THIS_SCRIPT and call $bootstrap->force_styleid(); (passing it the id of the style you want to use). I know, it seems strange that you shoudl have to have a plugin when you're writing your own script, but the problem is that the style is decided on and loaded all within global.php. I suppose another method would be to be to copy the code from global.php instead of including it, then you can insert a call to force_styleid(). But then you might have to update your scripts if global.php changes in a later version. A style can be specified in the parameter "styleid", so you might be able to do something like set $_REQUEST['styleid'] before global.php is included, but I notice that that sets a cookie with that style value, and I'm not sure if that will affect other pages or not. |
Quote:
I should be able to create globalgreenwidget.php, specify $bootstrap->force_styleid(); and of course change the custom page call to global to globalgreenwidget.php. The downfall as mentioned above, is having to maually fix this with every upgrade. |
AFAIR, the GET-method will set the style cookie. The best and easiest option really is to go with the plugin, in my opinion. Just have one plugin for all your custom pages, supply them with a unique THIS_SCRIPT or a unique constant of your choice, and switch it.
--------------- Added [DATE]1338576139[/DATE] at [TIME]1338576139[/TIME] --------------- Our posts crossed. You cannot use $bootstrap->force_styleid() in your own php page. You need to create a plugin, jsut as kh99 explained. Then there's no problem on updates. |
Can you give me an example?
|
Well, it's everything there, really.
In your own page, do something like this: After "define('THIS_SCRIPT', 'test');", add PHP Code:
Then create a plugin at global_bootstrap_init_start PHP Code:
|
not working, even tried registering $force_my_style on the custom page, still the parent style
|
That's my fault - [S]try using hook global_bootstrap_init_complete.[/S]
Sorry...one more time. This time I tested it: use hook global_bootstrap_complete and change the code to: Code:
global $force_my_style; BTW, nice solution, cellarius. Maybe this should be added to the article. |
All times are GMT. The time now is 05:44 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|