Jump to content

Disable ads individual pages

Featured Replies

Posted

I need to disable the display of advertising on individual pages of the site. How to do it?

  • 8 months later...

@EugeneZybov

ACP > Themes > Edit HTML and CSS
Templates > core > front > global > globalTemplate

Find:

{advertisement="ad_global_header"}

Replace with following:

{{if !(\IPS\Request::i()->app == 'core' and request.module == 'system' and \IPS\Request::i()->controller == 'register' or \IPS\Request::i()->controller == 'login' or \IPS\Request::i()->controller == 'lostpass' or \IPS\Request::i()->controller == 'page')}}
                      {advertisement="ad_global_header"}
{{endif}}

This will disable the global header Ad on Register, Login, Lost Password and "Page".

Here "Page" means that pages build using the Pages app.

So, the key is this code:

or \IPS\Request::i()->controller == 'register'

Keep on adding this code one after the other and simply change the Real URL controller page syntax. You can find it under: ACP > Advanced Configuration > Friendly URLs

The same goes for global footer Ads. Find:

{advertisement="ad_global_footer"}

Replace with following:

{{if !(\IPS\Request::i()->app == 'core' and request.module == 'system' and \IPS\Request::i()->controller == 'register' or \IPS\Request::i()->controller == 'login' or \IPS\Request::i()->controller == 'lostpass' or \IPS\Request::i()->controller == 'page')}}
                      {advertisement="ad_global_footer"}
{{endif}}

Cheers

Hello @Peter Sowerby, and in error pages, how to disable it?

Thanks.

@pequeno

If you could provide the full URL (copy from browser address bar) of the error page(s), that could be further looked into. 

Can someone help me to disable ads in the "not found" error page from IPS?

Error code. 1S160/2

I don't think that's easily possible without installing a plugin to set some global variable when on an error page. A variable that you could then access in the templates. 

I tried a bit, but couldn't find a way to do it, and the code doesn't seem to provide a value someone can check either. 

Archived

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

Recently Browsing 0

  • No registered users viewing this page.