The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
$forumid in conditional help
I've added some code to the end of my navbar template so that it would print out a phrase only for a few forums:
HTML Code:
<if condition="$forumid==16 || $forumid==45 || $forumid==46"> <phrase 1=$LMR_date>$vbphrase[tug_lmr_date]</phrase><br /> </if> My problem is that this conditional is sometimes triggering when the forum displays search results. It could be Today's Posts, it could be a search for posts by a given user, etc. I added some code before the conditional to always display the forum number in white (nearly invisible but can select with cursor to read it). This confirms that sometimes (not always) the forumid comes back as one of the three forum numbers when doing a search, and when it does the conditional kicks in. It does NOT seem to be tied to what forum the user is in when doing the search. You could be in forum 5, say, hit Today's Posts, and when the search results display, my "hidden" text may show that he's in forum 45, and the conditional triggers. It may be tied to the search results themselves somehow, but I have not been able to discern a pattern. It doesn't seem to be tied to the forum of the first search return found, nor the last one on the page, nor the last one on the last page. Can anybody tell me what is going on, and more importantly, how can I prevent it? |
#2
|
||||
|
||||
If you only want it to trigger on a forumdisplay page, then the first part of the condition should be THIS_SCRIPT == 'forumdisplay' AND (the forum condition here).
|
#3
|
||||
|
||||
Probably better to do it like this:
HTML Code:
<if condition="THIS_SCRIPT == 'forumdisplay' AND in_array($forum['forumid'], array(16,45,46))"> <phrase 1=$LMR_date>$vbphrase[tug_lmr_date]</phrase><br /> </if> HTML Code:
<if condition="THIS_SCRIPT == 'forumdisplay' AND in_array($forumid, array(16,45,46))"> <phrase 1=$LMR_date>$vbphrase[tug_lmr_date]</phrase><br /> </if> |
#4
|
||||
|
||||
Thanks, we're getting warmer.
I need it to show for any activity within those forums: forum display thread display entering or editing a message. |
#5
|
||||
|
||||
In that case you'l have to edit it and change this bit
HTML Code:
<if condition="THIS_SCRIPT == 'forumdisplay' HTML Code:
<if condition="in_array(THIS_SCRIPT, array('forumdisplay', 'showthread') |
Благодарность от: | ||
Lynne |
#6
|
||||
|
||||
Thanks again.
HTML Code:
<if condition="in_array($forumid, array(16,45,46))">
--------------- Added [DATE]1349212564[/DATE] at [TIME]1349212564[/TIME] --------------- That did the trick. What I ended up with: HTML Code:
<if condition="in_array($forumid, array(16,45,46)) AND in_array(THIS_SCRIPT, array('forumdisplay', 'showthread', 'newthread', 'newreply'))"> <phrase 1=$LMR_date>$vbphrase[tug_lmr_date]</phrase><br /> </if> I figured it would be best to test for forumid first, as that would give more rejections right away than testing for the script first. Is this proper thinking to minimize server load? Sure does seem strange to get those spurious forum numbers returned by forumid, but what the heck, this makes it a non-issue. Thanks again. I really appreciate those of you who give of your time to help out those of us with less programming knowledge. |
#7
|
||||
|
||||
They're not templates you're checking for!, they're php scripts, so fo argument sake you couldn't add 'footer' to the condition because it's a template and doesn't call a php script
|
#8
|
||||
|
||||
Thanks for the clarification. Much appreciated.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|