Log in

View Full Version : Any way to block ads from being shown in perticular forums or pages ?


anantthakor
05-18-2008, 02:51 AM
Is there any way to stop from being shown ads in perticular forums of site ?

This is will be good help for those who have adult sites and want to use google adsense revenue sharing :)

veenuisthebest
05-18-2008, 03:08 AM
Wrap your Ad code in the following conditional ..

<if condition="$forumid != X">

Your Ad Code here

</if>


where X is your forum ID where you do not want to display Ad

anantthakor
05-18-2008, 03:11 AM
but where ? in which template. please give me example using any google adsense modification :)

veenuisthebest
05-18-2008, 03:15 AM
For vB 3.7, you now have Ad Location Templates, paste the Google Adsense code in any of the desired templates like ad_header_logo.

And simply wrap that code in the conditional i.e.


<if condition="$forumid != X">

YOUR
GOOGLE
ADSENSE
CODE
HERE

</if>



where X is the forum ID where you do NOT want to show the Ad. Hope this helpsss

anantthakor
05-18-2008, 03:24 AM
I tried this but while adding i am having this error

Parse error: syntax error, unexpected ',' in /public_html/includes/adminfunctions_template.php(3717) : eval()'d code on line 1

veenuisthebest
05-18-2008, 03:26 AM
Post your complete code.. that you applied to the template !!

anantthakor
05-18-2008, 03:30 AM
<if condition="$forumid != 12,235,236,267">

my adsense code

</if>

I used this bcoz i dont want show these ads more above these 4 forums

veenuisthebest
05-18-2008, 03:32 AM
<if condition="$forumid != 12,235,236,267">

this is wrong, it won't accept an array of ID's..
the conditional I provided works for just 1 forum like this

<if condition="$forumid != X">

anantthakor
05-18-2008, 03:33 AM
But i want to bock this in 4 forums like i tried :(

Please provide me codes for that :)

veenuisthebest
05-18-2008, 03:35 AM
okk... try this for multiple forums.. not sure if it works !!

<if condition="out_array($forum['forumid'], array(12,235,236,267))">

anantthakor
05-18-2008, 03:38 AM
It shows this message

The following template conditional expression contains function calls:

<if condition="out_array($forum['forumid'], array(12,235,236,267))">

Function Name Usage in Expression
out_array out_array($forum['forumid'], array(12,235,236,267)

With a few exceptions, function calls are not permitted in template conditional expressions. Please go back and re-write this expression.

The following functions are allowed in template conditional expressions:
in_array() is_array() is_numeric() isset() empty() defined() array() can_moderate() can_moderate_calendar() exec_switch_bg() is_browser() is_member_of()

veenuisthebest
05-18-2008, 03:41 AM
okay... then do one thinggggg !! use this conditional instead

<if condition="in_array($forum['forumid'], array(X,X,X,X,X,X,X,X,X))">

But this time replace the X's with the forum ID's where YOU WANT to show the Ads.

anantthakor
05-18-2008, 03:47 AM
Its working 100%

Btw try to get blocking code also if you can :)

I have more than 100 forums :D

veenuisthebest
05-18-2008, 03:55 AM
ya.. I understand lol

okayy... try this and tell me if it works !!!

<if condition="in_array(!$forum['forumid'], array(12,235,236,267))">

anantthakor
05-18-2008, 04:32 AM
Now not needed :D I made whole list :)

Thanks alot for your fast and perfect support :)