Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-27-2018, 05:38 PM
shibby2 shibby2 is offline
 
Join Date: Jul 2005
Posts: 303
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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!
Reply With Quote
  #2  
Old 08-27-2018, 08:18 PM
blind-eddie's Avatar
blind-eddie blind-eddie is offline
 
Join Date: Apr 2006
Location: Michigan
Posts: 2,310
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Add this conditional to your ad code in your navbar template.
Code:
<if condition="THIS_SCRIPT != 'login'">
Your ad code
</if>
Reply With Quote
Благодарность от:
MarkFL
  #3  
Old 08-27-2018, 10:37 PM
shibby2 shibby2 is offline
 
Join Date: Jul 2005
Posts: 303
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
Благодарность от:
blind-eddie
  #4  
Old 08-27-2018, 11:57 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by shibby2 View Post
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.
Reply With Quote
  #5  
Old 08-28-2018, 06:10 AM
shibby2 shibby2 is offline
 
Join Date: Jul 2005
Posts: 303
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Thanks again!
Reply With Quote
  #6  
Old 08-28-2018, 07:32 AM
iA1 iA1 is offline
 
Join Date: Jul 2018
Posts: 150
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this mod, it should help: https://vbulletin.org/forum/showthread.php?t=326045
Reply With Quote
  #7  
Old 08-28-2018, 09:48 PM
blind-eddie's Avatar
blind-eddie blind-eddie is offline
 
Join Date: Apr 2006
Location: Michigan
Posts: 2,310
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarkFL View Post
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.
Attached Images
File Type: png Capture.PNG (1.6 KB, 0 views)
Reply With Quote
  #8  
Old 08-29-2018, 06:57 PM
shibby2 shibby2 is offline
 
Join Date: Jul 2005
Posts: 303
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Take care for now!
Reply With Quote
Благодарность от:
MarkFL
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:15 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04398 seconds
  • Memory Usage 2,263KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_html
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (3)post_thanks_box_bit
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (1)postbit_attachment
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete