Jump to content

How to disable ads in certain forum nodes?


Shyuan

Recommended Posts

Hi,

I am using IPS 4.1.17.1. I have ads in two places: `ad_sidebar` and `ad_topic_view`. But I would like to disable these ads in forum node 27.

I came across the ads removal code in certain forum nodes @thompsone provided here. I tried modifying and implementing the code to my `ad_sidebar` and `ad_topic_view` myself but I don't seem to get it working. IPS Support won't be able to help, so I was told to post my question here.

I am not a programmer, so I don't really know what's going on here.. Any help/advice would be much appreciated. Thank you. :)

`ad_sidebar` snippet from `sidebar` template:

{{if isset(\IPS\Output::i()->sidebar['widgets']['sidebar']) and count( \IPS\Output::i()->sidebar['widgets']['sidebar'] ) and ( \IPS\core\Advertisement::loadByLocation( 'ad_sidebar' ) ) }}
			{advertisement="ad_sidebar"}
			<br><br>
{{endif}}

`ad_topic_view` snippet from `topic` template:

{{if $postCount == 1 AND $advertisement = \IPS\core\Advertisement::loadByLocation( 'ad_topic_view' )}}
			{$advertisement|raw}
{{endif}}
Link to comment
Share on other sites

I posted it 24 hours ago.. (not trying to say people must reply me asap, but I am just replying you because you thought i just posted this a few minutes ago). My bad for bumping the thread after 24 hours. I will remove that.

1 minute ago, sweethoney said:

if nobody gets to your topic after a few minutes....  just Waite someone will respond to it.... they can see it...they might be looking 4 the answer

 

Link to comment
Share on other sites

17 minutes ago, sweethoney said:

may i ask what are you trying 2 do just disable in a forum or the site

If i understand you correctly. I just want to disable the sidebar and topic view ads in forum node 27 but remain the same on any part of other forums. Thanks.

Link to comment
Share on other sites

Just now, sweethoney said:

wht is your url so we can uderstand and i will join

Hi,

Ads are enabled for sidebar and after first post in a topic. This is across entire forum. I have a forum section which is a private section and I do not want my ads in there since that will violate Google Adsense rules. So I want to get rid of the sidebar ads and after first post ads only in that private forum section. So this requires some template editing. I know basic template editing and can understand some of them. Unfortunately I don't understand how can I implement the "remove ads for a certain forums" code discussed in another topic as I linked in my first message. But I am trying. :)

Link to comment
Share on other sites

Also take a look at the comments in this tip:

You can probably wrap the ad tag with the forum ids you want it to show in.

Maybe something like...not sure if this would work.

{{if request.app == 'forums' && request.module == 'forums'}}
	{{$id = \IPS\Request::i()->id;}}
	{{if $id == '27'}}

{{else}} 

your ad tag

	{{endif}}
{{endif}}

 

Link to comment
Share on other sites

Hello,

On 21.12.2016 at 3:51 AM, Shyuan said:

`ad_sidebar` snippet from `sidebar` template:

{{if isset(\IPS\Output::i()->sidebar['widgets']['sidebar']) and count( \IPS\Output::i()->sidebar['widgets']['sidebar'] ) and ( \IPS\core\Advertisement::loadByLocation( 'ad_sidebar' ) ) and !(request.app == 'forums' and request.module == 'forums' and request.controller == 'forums' and request.id == 27)}}
	{advertisement="ad_sidebar"}
	<br><br>
{{endif}}

 

On 21.12.2016 at 3:51 AM, Shyuan said:

`ad_topic_view` snippet from `topic` template:

{{if $postCount == 1 AND $advertisement = \IPS\core\Advertisement::loadByLocation( 'ad_topic_view' ) and $topic->forum_id != 27}}
			{$advertisement|raw}
{{endif}}

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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