vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Conditionals (https://vborg.vbsupport.ru/showthread.php?t=253724)

Xtrigit 11-15-2010 01:18 PM

Conditionals
 
I want to display an ad on the showthread.php page but show a different ad depending on what forums the user is browsing.

PHP Code:

<vb:if condition="in_array($threadinfo['forumid'], array(1, 2, 3))">
Ad code
</vb:if> 

I need something similar to the above but a different ad code for each forum (1,2,3)

thanks

Lynne 11-15-2010 01:29 PM

Something like... ?
HTML Code:

<vb:if condition="$threadinfo['forumid'] == 1">
ad for 1
<vb:elseif condition="$threadinfo['forumid'] == 2" />
ad for 2
<vb:elseif condition="$threadinfo['forumid'] == 3" />
ad for 3
</vb:if>


Xtrigit 11-15-2010 01:58 PM

Awesome!

Now, what if I want to do the same but this time to certain forum groups?

I tried:
PHP Code:

<vb:if condition="in_array($threadinfo['forumid'], array(1,2))">
ad code
<vb:elseif condition="in_array($threadinfo['forumid'], array(3,4))">
ad code
<vb:elseif condition="in_array($threadinfo['forumid'], array(5, 6))">
ad code
</vb:if> 

But it didn't work.

Lynne 11-15-2010 02:45 PM

How exactly didn't it work? Just saying "it didn't work" tells us nothing.

Xtrigit 11-15-2010 03:36 PM

Thank you, Lynne!

As you can see, I forgot the slash "/" in the <vb:elseif tag.

Working great now (:

Lynne 11-15-2010 05:34 PM

Ah yes, that / is very important! :)


All times are GMT. The time now is 12:53 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
  • Page Generation 0.01031 seconds
  • Memory Usage 1,722KB
  • 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
  • (1)bbcode_html_printable
  • (2)bbcode_php_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