The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
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:
|
#2
|
|||
|
|||
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) |
#3
|
||||
|
||||
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... |
#4
|
||||
|
||||
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"; } } |
#5
|
||||
|
||||
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:
|
#6
|
||||
|
||||
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.
|
#7
|
||||
|
||||
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']
|
#8
|
||||
|
||||
So this is part of a larger hack then and not just for the width?
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|