Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Override Style on Custom Pages
tyrionlannister
Join Date: May 2007
Posts: 11

 

New York
Show Printable Version Email this Page Subscription
tyrionlannister tyrionlannister is offline 06-28-2007, 10:00 PM

I just spent a bit of time searching the forums for how to override a style on a custom page and I didn't find anything, so I thought I'd post this in case someone else searches for this in the future.

I spent some time reading through the vBulletin code and realized that regardless of which style variables you modify in your custom php page, they are redefined in init.php and global.php when you include global.php in your script. You can't add anything after global.php because the style has already been processed.

The only way it can be done without editing vBulleting files is through a hook.

Simply go to your AdminCP and click the "Add New Plugin" under the Plugins and Products manager. Since your custom page is a product (you should already have defined this), make sure to change the Product Name dropdown to whatever you've named it.

Select 'style_fetch' from the Hook Location dropdown, describe the plugin, and modify this based on your own code settings:

PHP Code:
if ($youroptions['forcestyle'] == true) {
    
$styleid = ($youroptions['forcedstyleid']);


This will work for simple scripts, but you will run into problems if you are using the vBulletin database class or input cleaner to help determine whether the style should be overwritten.

In this case, you could code your logic into an include script which is only called if this is a custom page.

In your custom pages, you should have

PHP Code:
define('THIS_SCRIPT''yourcustomscriptname'); 
And your hook code should read:

PHP Code:
if (THIS_SCRIPT == 'yourcustomscriptname') {
    require  (
'./yourinclude.php');
    if (
$youroptions['forcestyle'] == true) {
        
$styleid = ($youroptions['forcedstyleid']);    
    }

Reply With Quote
  #2  
Old 04-21-2014, 10:54 PM
fxdigi-cash fxdigi-cash is offline
 
Join Date: Jul 2012
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried it on vb4, but didn't work... I wish it could though
Reply With Quote
  #3  
Old 04-22-2014, 08:48 PM
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
Senior Member
 
Join Date: Sep 2008
Location: North Carolina
Posts: 5,844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by fxdigi-cash View Post
I tried it on vb4, but didn't work... I wish it could though
Hmm not sure why it wouldn't unless the hook location is not present or similar but no I have not tested the above code I'm just going to say try this article and see if does the trick - it explains how to overwrite css based on certain conditions (or you can add-in/remove conditionals).

https://vborg.vbsupport.ru/showthread.php?t=3077394
Reply With Quote
  #4  
Old 04-22-2014, 09:53 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TheLastSuperman View Post
Hmm not sure why it wouldn't unless the hook location is not present or similar but no I have not tested the above code I'm just going to say try this article and see if does the trick - it explains how to overwrite css based on certain conditions (or you can add-in/remove conditionals).

https://vborg.vbsupport.ru/showthread.php?t=3077394
Hey buddy, for some reason the thread link is invalid.
Reply With Quote
  #5  
Old 04-29-2014, 10:00 PM
fxdigi-cash fxdigi-cash is offline
 
Join Date: Jul 2012
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TheLastSuperman View Post
Hmm not sure why it wouldn't unless the hook location is not present or similar but no I have not tested the above code I'm just going to say try this article and see if does the trick - it explains how to overwrite css based on certain conditions (or you can add-in/remove conditionals).

https://vborg.vbsupport.ru/showthread.php?t=3077394
Thanks, but yes the link is invalid as mentioned...!!

would you mind to provide the correct one?? Thanks

--------------- Added [DATE]1398813444[/DATE] at [TIME]1398813444[/TIME] ---------------

can you kindly give an example, possibly I'm doing it wrong somewhere!!!

I tried changing the following though:

from this -->

Code:
if ($youroptions['forcestyle'] == true) {
    $styleid = ($youroptions['forcedstyleid']);
}
to this:

Code:
if ($youroptions['forcestyle'] == true) {
    $styleid = ($youroptions['1']);
}
and of course defined the script in the .php file like this:

Code:
define('THIS_SCRIPT', 'aforum');
Then not sure where to add the last code:

Code:
if (THIS_SCRIPT == 'aforum') {
    require  ('./global.php');
    if ($youroptions['forcestyle'] == true) {
        $styleid = ($youroptions['1']);    
    }
}
any idea???

--------------- Added [DATE]1398815083[/DATE] at [TIME]1398815083[/TIME] ---------------

ok, here is the whole story of what I'm up to just to avoid the confusion...

I wanted to have two pages of FORUMHOME where I can display some forums in one and other forums in the other one. I created a copy of forum.php file and named it aforum.php "exact copy", but changed any FORUMHOME inside the code to match the new copy FORUMHOME2.

I then created a template in all styles called "FORUMHOME2" exact copy of "FORUMHOME"

I could see almost everything there except that some plugins don't know what "FORUMHOME2" is... so they don't work on that page...

now I wanted to change the style of the new page "FORUMHOME2" so I created the plugin based on this article

Code:
if ($youroptions['forcestyle'] == true) {
    $styleid = ($youroptions['1']);
}
Code:
define('THIS_SCRIPT', 'aforum');
but still the style didn't work.... I think I missed something here!!!

any idea??
Reply With Quote
  #6  
Old 05-06-2014, 03:32 PM
TTayfun's Avatar
TTayfun TTayfun is offline
 
Join Date: Aug 2011
Location: Istanbul, Turkey
Posts: 211
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:27 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
  • Page Generation 0.04188 seconds
  • Memory Usage 2,263KB
  • Queries Executed 21 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_code
  • (3)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (1)post_thanks_box_bit
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (6)post_thanks_postbit_info
  • (5)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete