vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Conditional display of banners (https://vborg.vbsupport.ru/showthread.php?t=144772)

RFID Talk 04-13-2007 06:47 PM

Conditional display of banners
 
Hi folks:

I believe this should be straightforward for experienced vBulletin hands, but I've been unable to figure it out.

We rotate banners from a number of advertisers across our forum at www.rfidtalk.com. But we have one forum in particular that has a fixed advertiser. To display just the banner from that advertiser, we need to use a different banner-display code snippet than the standard one. So, what I want to do is put in the header template a simple condition that will display the normal banner-display code snippet by default, or the fixed advertiser's code snippet otherwise. Like so:

If (forum = "Employment Forum") {
Display fixed-advertiser snippet
}
Else {
Display standard code
}

Any ideas?

Thanks!

Will

zardos 04-13-2007 11:27 PM

<if condition="$forum[forumid] == X"></if>

HMBeaty 04-13-2007 11:38 PM

BTW, you can't use php in templates ;)

Kungfu 04-13-2007 11:48 PM

Quote:

Originally Posted by zardos (Post 1227094)
<if condition="$forum[forumid] == X"></if>

<if condition="$forum[forumid] == X"></if><else>do something else</else>

to expand onto that.

zardos 04-14-2007 12:06 AM

<if condition="$forum[forumid] != 1">everywhere except 1</if>
<if condition="$forum[forumid] == 1">only in 1</if>

RFID Talk 04-17-2007 01:32 PM

Thank you everyone for your responses.

I have tried your suggestions, but unfortunately it doesn't appear to be working. Only the ELSE part of the condition is ever executed, even when I'm in the forum whose forumid is specified in the IF condition. Here is the code I'm using in the header template:

Code:

<!-- banner -->
<br />
<div align="center">

<if condition="$forum[forumid] == 10"><iframe ad="special" width="728" height="90" ... more HTML ad code ... ></iframe></if>
<else><iframe ad="normal" width="728" height="90" ... more HTML ad code ... ></iframe></else>

</div>
<!-- /banner -->


So basically, even when I am in forum 10, the condition does not evaluate to true.

As another clue, using the HTML code below I attempted to display the $forum[forumid] variable in the header template to see what it's value was. But no value displays, leading me to believe that $forum[forumid] is null. Could it be that $forum[forumid] is not being set?
Code:

<strong>Forum:</strong> $forum[forumid]


All times are GMT. The time now is 09:58 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01067 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete