vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How to disable an ad from certain pages? (https://vborg.vbsupport.ru/showthread.php?t=326689)

shibby2 08-27-2018 05:38 PM

How to disable an ad from certain pages?
 
Hey guys, just wondering if you could tell me how I could remove Google ads from a certain page? For example, I have Adsense code installed in my NAVBAR template, so it shows the ad on all pages (wherever the navbar template is). I don't want the ad to show on certain pages like the "lost password" page, so how would I go about disabling the ad on that page?

Any help is very appreciated, thanks!

blind-eddie 08-27-2018 08:18 PM

Add this conditional to your ad code in your navbar template.
Code:

<if condition="THIS_SCRIPT != 'login'">
Your ad code
</if>


shibby2 08-27-2018 10:37 PM

Thanks! But, could you possibly explain a little better for me? I'm not too bright when it comes to this stuff. lol So I'm assuming I would change "THIS_SCRIPT" to the name of the file where I don't want the ads to appear? Also, if there were a few different pages I didn't want ads to run on, how would I do that?

Thanks again so much! :)

MarkFL 08-27-2018 11:57 PM

Quote:

Originally Posted by shibby2 (Post 2596158)
Thanks! But, could you possibly explain a little better for me? I'm not too bright when it comes to this stuff. lol So I'm assuming I would change "THIS_SCRIPT" to the name of the file where I don't want the ads to appear? Also, if there were a few different pages I didn't want ads to run on, how would I do that?

Thanks again so much! :)

THIS_SCRIPT is a constant that stores the name of the script being run, for external scripts that define it. So, use Tim's code exactly as is to prevent ads from displaying on the login script.

If you wish to stop ads on multiple scripts, then you could use something like:

HTML Code:

<if condition="!in_array(THIS_SCRIPT, array('login', 'script2', 'script3',...))">
Your ad code
</if>

Replace 'script1' and 'script2' with the other scripts on which you want to prevent ads. You can list as many as you desire.

shibby2 08-28-2018 06:10 AM

Oh ok, gotcha! Thanks so much guys! I'll give it a try tomorrow and let ya know how I made out.

Thanks again! :)

iA1 08-28-2018 07:32 AM

Try this mod, it should help: https://vbulletin.org/forum/showthread.php?t=326045

blind-eddie 08-28-2018 09:48 PM

1 Attachment(s)
Quote:

Originally Posted by MarkFL (Post 2596160)
THIS_SCRIPT is a constant that stores the name of the script being run, for external scripts that define it. So, use Tim's code exactly as is to prevent ads from displaying on the login script.

If you wish to stop ads on multiple scripts, then you could use something like:

HTML Code:

<if condition="!in_array(THIS_SCRIPT, array('login', 'script2', 'script3',...))">
Your ad code
</if>

Replace 'script1' and 'script2' with the other scripts on which you want to prevent ads. You can list as many as you desire.

https://nacc.club/vbimghost.php?do=d...img&imgid=1167

shibby2 08-29-2018 06:57 PM

Thanks so much guys, it works perfectly! :) I'm definitely going to check out that MOD too!

Take care for now!


All times are GMT. The time now is 09:04 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00946 seconds
  • Memory Usage 1,728KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_html_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete