The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
forumid conditional help in templates please?
I'm trying to edit my forumhome_lastpostby template to display a banner only for a certain forumid. Here's the conditional I'm using, which is not working. Any help is appreciated:
<vb:if condition="$forum['forumid'] == 38"> <div style="float:right;">banner here</div> </vb:if> I've also tried $foruminfo['forumid'], and I've even tried making a plugin to register a new variable and then using that in the conditional as follows: $thisforumid = $forum['forumid']; vB_Template:reRegister('forumhome_lastpostby',ar ray('thisforumid' => $thisforumid)); Any suggestions? This was so easy in vb3, crazy how it's so difficult (or I'm just missing something terribly easy) in vB4. Thanks in advance! |
#2
|
||||
|
||||
For that template, I would try the variable $threadinfo instead of $forum.
|
#3
|
|||
|
|||
Quote:
1) Placing $threadinfo['forumid'] directly in the conditional: <vb:if condition="$threadinfo['forumid'] == 38"> <br /><br /> <div style="float:right;">banner here</div> <br /><br /> </vb:if> 2) Creating a plugin to register the variable $thisforumid and then placing that in the forumhome_lastpostby template: Plugin: $thisforumid = $threadinfo['forumid']; vB_Template:reRegister('forumhome_lastpostby',ar ray('thisforumid' => $thisforumid)); Template: <vb:if condition="$thisforumid == 38"> <br /><br /> <div style="float:right;">banner here</div> <br /><br /> </vb:if> For what it's worth, forumid 38 is the parent forum and there are several subforums below it. I'm assuming that the parent forum ID I need to use here, as that's how it's cycling through on FORUMHOME to show all of the forums. I have, however, also tried putting both the parent and subforum ID's all in an in_array conditional as well - which also didn't work. Screenshot is attached here for review. |
#4
|
||||
|
||||
Try $lastpostinfo instead of $threadinfo or $forum.
|
#5
|
|||
|
|||
Ok, just a quick update...I changed the plugin to this:
$thisforumid = $forum['forumid']; vB_Template:reRegister('forumhome_lastpostby',arra y('thisforumid' => $thisforumid)); Then, I moved the hook location for the plugin to forumbit_display and now the variable $thisforumid is available and displays within FORUMHOME in the correct place... The problem is - it displays the forumid in the forum below where it's supposed to be. For example, the lastpostby area does not show anything for the first forum. However, in the lastpostby area for the SECOND forum, it shows the forumid of the FIRST forum. In the 3rd forum, it shows the forumid of the second forum, etc. until the end of the list. Does that help shed any light on things? Maybe with combined brains, we can figure this out. --------------- Added [DATE]1308435240[/DATE] at [TIME]1308435240[/TIME] --------------- Just tried that too, Boofo.. <vb:if condition="$lastpostinfo['forumid'] == 38"> <br /><br /> <div style="float:right;">forum 38 banner here</div> <br /><br /> </vb:if> Nothing shows up when I do that, either unfortunately. |
#6
|
||||
|
||||
This is what I use at the very top of my forumhome_lastpostby template and it works fine. You need the else. Also add </vb:if> to the very bottom of the template.
Code:
<vb:if condition="$lastpostinfo['forumid'] == '36'"> <div> </div> <div style="text-align: center;"> VIP Forum </div> <vb:else /> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|