![]() |
Forumhome Forumbit HELP!
Hey. I'm having trouble getting a template mod to work with the 4 forumhome forumbit templates. Basically, I want to give my users the ability to turn off forum icons in my forum listings to save bandwidth. Unfortunately the system always evaluates the following to false.
HTML Code:
<if condition="$forum['icon'] AND $extrauseroptions['display_forumicon']"> Now I've used this kind of conditional in $threadbit, $header, $navbar, $FORUMHOME with NO PROBLEMS WHATSOEVER!!! Why is the system failing to recognize this variable in these four templates. NOTE: I *suspect* it has to do with variable scope, but if that's the case WHY ONLY HERE?? Why haven't I seen this occur in $threadbit, postbit, etc?? -- Getting incredibly fustrated here, Mike. |
try removing the single quotes, I don't believe you can have them in a conditional
Code:
<if condition="$forum[icon] AND $extrauseroptions[display_forumicon]"> |
Quote:
The syntax is correct - it works in EVERY TEMPLATE EXCEPT the four forumhome_forumbits. WHY? |
I presume you have verified the values by outputting them to the page. For instance, you say that "$forum['icon']" works, so I presume you sent it to the page to verify its contents for each forum. Did you do the same for "$extrauseroptions" to verify that it contains nothing?
Post the code that sets "$extrauseroptions". |
Quote:
<if condition="$forum['icon']">code</if> works without a hitch. It's output can be seen in the images it fetches. I've run tests where I simply typed $extrauseroptions['display_forumicon'] = true; And it didn't work. I've echo'ed the variable at the end of the phpinclude_end template and it's came back as 1, which is normal for a boolean. The only thing I can think of is that it's simply not being *seen* by the section of code that parses those templates and I need to make the variable global in scope somehow. Short of adding it's value to $GLOBALS I don't know how (and I've never had to worry about variable scope before with vbulletin so I'm not too sure even then). |
Try this
Code:
<if condition="$forum[icon] == 1 AND $extrauseroptions[display_forumicon] == 1"> It would only be a scope problem if $extrauseroptions was set in a function and wasn't returned, nor set to global within the function. |
it could be because that template is used in a file that does not use those variables;)
|
No, in PHP functions can't see variables outside themselves unless they are declared as global. So if the forumbit templates are evalutated by a function...
I tried directly linking to $bbuserinfo, no go there either, and as far as I know that's a vbulletin global... So I give up. And let me repeat for those who didn't read it the first time: $forum['info'] works by itself. Therefore the problem MUST BE in the second variable. I've altered the code to print the value of the variable - and sure enough it's null in those templates only even when it has a value elsewhere. |
^^ that's exactly what I said ;)
try this, open up functions_forumlist.php and find Code:
function construct_forum_bit($parentid, $depth = 0, $subsonly = 0) Code:
global $extrauseroptions; |
Ok, I'll try that tomorrow. Right now my setup is under executive review - I dare not hack something and cause a parse error. Thx.
|
All times are GMT. The time now is 06:23 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|