Jump to content

Exclude Ads from given forums/areas


Recommended Posts


i want some ad codes not to be shown in special subforums/areas of the site. Is there any smart way to do this?

For example: Ad code from Google (Adsense) shall not be shown in a sub forum called "Google Adsense Problems" while other Ad code can be displayed there without problems.

Link to comment
Share on other sites

Part of your solution is here: IPS Thread

I have personally battled with this and keeping Adsense happy is goal number one.

Now you'll have to combine that with a ELSE statement so if it doesn't show ads because it's excluded then show another ad.  I'm not an expert but I imagine it would look something like this.

{{if ( \IPS\Request::i()->controller == 'forums' AND isset( \IPS\Request::i()->id ) AND ! in_array( \IPS\Request::i()->id, array( forum_id1, forum_id2, forum_id3, forum_id4 ) ) ) OR !( in_array( \IPS\Request::i()->controller, array( 'system_app1', 'system_app2', 'system_app3', 'forums' ) ) OR in_array( \IPS\Request::i()->app, array( 'external_app1', 'external_app2') ) )}}


Edited by thompsone
Link to comment
Share on other sites

i've simply add an id to ads, and removed with something like this:  $( "#adsid" ).remove(); added only in page where i want remove (eg in a sidebar block) ;)

imho, more simple :)

u can test in my laltroweb.it/tools/bugtrack/ page.

(ads in sidebar is removed here)!





Edited by laltroweb.it
Link to comment
Share on other sites

  • 4 years later...

This proved to be a useful topic, thanks @thompsone

Though I got a question how should the code look so that the advertisement code would also include the ad appear in the TOPIC VIEW of a certain FORUM ID too. I mean to show ads on the top of the page when viewing any topic that is within a forum which ID is for example 55, 65 and 75?

I've found this post but I don't understand enough to make it work.

@newbie LAC, @opentype any ideas guys? 🙂

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...