PDA

View Full Version : Conditional Statement in Ad Location Templates


rcull
02-20-2017, 12:13 AM
I was trying to add a condition to the display of an ad:
<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

<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/forum/vbulletin-3-8/vbulletin-3-8-questions-problems-and-troubleshooting/vbulletin-quick-tips-and-customizations/205830-vbulletin-conditionals

Thanks

Paul M
02-20-2017, 04:51 PM
That did it!

I had been using information from this page:
https://www.vbulletin.com/forum/forum/vbulletin-3-8/vbulletin-3-8-questions-problems-and-troubleshooting/vbulletin-quick-tips-and-customizations/205830-vbulletin-conditionals

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