The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
if ($show['forumdescription']) doesn't work in process_templates_complete
Ok the question is simple the conditional "if ($show['forumdescription'])" always retur false..
this code works Code:
$replace = '<h2 class="forumtitle"><div id="scanu"><a '; $replace .= 'title="<scanu>\' . $forum[\'description\'] . \'</scanu>" '; $replace .= 'href="\' . vB_Template_Runtime::linkBuild("forum", $forum) . \'">\' . $forum[\'title\'] . \'</a></div></h2>'; Code:
$replace = '<h2 class="forumtitle"><div id="scanu"><a '; if ($show['forumdescription']) { $replace .= 'title="<scanu>\' . $forum[\'description\'] . \'</scanu>" '; } $replace .= 'href="\' . vB_Template_Runtime::linkBuild("forum", $forum) . \'">\' . $forum[\'title\'] . \'</a></div></h2>'; |
#2
|
|||
|
|||
So I guess that's in a plugin using hook forumbit_display? The problem is that $show['forumdescription'] hasn't been set yet. But the line that sets it looks like this:
Code:
$show['forumdescription'] = ($forum['description'] != '' ? true : false); so you should just be able to use $forum['description'] != '' instead. |
#3
|
||||
|
||||
No the hook is process_templates_complete (it is another plugin) however i'll try again
--------------- Added [DATE]1324500305[/DATE] at [TIME]1324500305[/TIME] --------------- |
#4
|
|||
|
|||
The same thing might work in that template, but you may need to add
Code:
global $forum; to the beginning of the plugin code. |
#5
|
||||
|
||||
It return false even if there's a description that's my code
Code:
global $forum; $show['forumdescription'] = ($forum['description'] != '' ? true : false); $replace = '<h2 class="forumtitle"><div id="scanu"><a '; if ($show['forumdescription']) { $replace .= 'title="<scanu>\' . $forum[\'description\'] . \'</scanu>" '; } |
#6
|
|||
|
|||
It could be that $forum isn't set yet, I'm not sure.
Oh...what are you doing with the value, are you changing a cached template? The problem probably is that displaying the forum page uses the template many times but process_templates_complete is only called once (I think). You'll probably have to figure out some other way of doing it. Maybe insert a variable into the template then set the variable from anotehr hook depending on the current value of $forum[description]. |
#7
|
||||
|
||||
what hook for example? And the code would be something like this?
Code:
if ($show['forumdescription']) { $description = true; } else { $description = false; } |
#8
|
|||
|
|||
Right, but you'd have to get that in the template so that it all ran OK. I really can't tell you which hook to use without knowing exactly what you're trying to do. Just try to find a hook that's called each time that template is used.
|
#9
|
||||
|
||||
you'd have to get that in the template so that it all ran OK
What do you mean? |
#10
|
|||
|
|||
Are you trying to modify a cached template?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|