vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Conditional Statement in Ad Location Templates (https://vborg.vbsupport.ru/showthread.php?t=324489)

rcull 02-20-2017 12:13 AM

Conditional Statement in Ad Location Templates
 
I was trying to add a condition to the display of an ad:
Code:

<vb:literal>
<if condition="is_member_of($bbuserinfo, 1, 3, 4, 8, 31, 32)">
<div align="right"><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Team Buick, 300x250 -->
<ins class="adsbygoogle"
    style="display:inline-block;width:300px;height:250px"
    data-ad-client="ca-pub-5874277334279308"
    data-ad-slot="7439119065"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</if>
</vb:literal>

I got this error:

PHP Warning: Invalid argument supplied for foreach() in ..../includes/functions.php on line 3823

The following error occurred when attempting to evaluate this template:
%1$s
This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.

What did I do wrong
Thanks!

z3r0 02-20-2017 04:56 AM

Your if conditions should be <vb:if and </vb:if

Code:

<vb:literal>
<vb:if condition="is_member_of($bbuserinfo, 1, 3, 4, 8, 31, 32)">
<div align="right"><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Team Buick, 300x250 -->
<ins class="adsbygoogle"
    style="display:inline-block;width:300px;height:250px"
    data-ad-client="ca-pub-5874277334279308"
    data-ad-slot="7439119065"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</vb:if>
</vb:literal>


rcull 02-20-2017 12:54 PM

That did it!

I had been using information from this page:
https://www.vbulletin.com/forum/foru...n-conditionals

Thanks

Paul M 02-20-2017 04:51 PM

Quote:

Originally Posted by rcull (Post 2582655)
That did it!

I had been using information from this page:
https://www.vbulletin.com/forum/foru...n-conditionals

Thats for vB3, not vB4 (hence its in the vB3 section :)).


All times are GMT. The time now is 12:38 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.01225 seconds
  • Memory Usage 1,717KB
  • 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
  • (4)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