Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 06-19-2008, 04:33 PM
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Dynamically alter $stylevar['codeblockwidth']

I have been trying to dynamically alter the width of $stylevar['codeblockwidth'] based upon a condition in php, however it's not behaving as expected. It's just stretching to the max width to fit all the contents within the code tags.

I am inserting the following code into hook group_complete
PHP Code:
$stylevar['codeblockwidth']    = $vbulletin->options['scst_rightgblockwidth']; 
Anyone know why it's not working?
Reply With Quote
  #2  
Old 06-19-2008, 05:29 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you checked the PHP code around the hook, it might give you clues.

Maybe the variable names are incorrect or something?

Where is the hook located? (I haven't used/come across it before)
Reply With Quote
  #3  
Old 06-19-2008, 05:36 PM
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the hook's located within group.php

I'm thinking it's something to do with bbcode being parsed at adifferent time than template output. Problem is though that template bbcode_code is cached way before any php runs at all, which might be a problem as well...
Reply With Quote
  #4  
Old 06-19-2008, 05:36 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to add it to global_start. That is where I am doing the same type thing.

Code:
if (is_browser('ie'))
{
 if (THIS_SCRIPT != 'private')
 {
  $stylevar['codeblockwidth'] = "890px";
 }
 else
 {
  $stylevar['codeblockwidth'] = "745px";
 }
}
I have it set to auto in the skin.
Reply With Quote
  #5  
Old 06-19-2008, 05:48 PM
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Boofoo, That would work for me if I just needed to modify it to the same size, all the timje, however since it's being modified based upon a conditional within the $group array, that's too soon...

But seeing your code did help me figure out the problem... the issue was that the template bbcode_code sets the width using $stylevar['codeblockwidth'] as expected, but the 'px' isn't included in the template, it is included in the var... so the following works as expected within hook group_complete

PHP Code:
switch($sc_gblock['position'])
{
    case 
'left':
    {
        
$stylevar['codeblockwidth'] = ($vbulletin->options['scst_leftgblockwidth'] - 60) . 'px';
    }
    break;
    case 
'right':
    {
        
$stylevar['codeblockwidth'] = ($vbulletin->options['scst_rightgblockwidth'] - 60) . 'px';
    }
    break;

Reply With Quote
  #6  
Old 06-19-2008, 05:53 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is the minue 60 for? I set the width to auto as FF handles that fine. It is just IE that gets messed up with auto. I could have dione it with a setting variable but since I am only doing it in one skin, I hard-coded it.
Reply With Quote
  #7  
Old 06-19-2008, 06:20 PM
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm using the - 60 to make ensure that the code is less than the width of the cell, which is set using $vbulletin->options['scst_leftgblockwidth']
Reply With Quote
  #8  
Old 06-19-2008, 06:33 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So this is part of a larger hack then and not just for the width?
Reply With Quote
Reply

Thread Tools
Display Modes

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:12 PM.


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.04293 seconds
  • Memory Usage 2,224KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • 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