View Full Version : Google Adsense In Navbar
dieselpowered
12-09-2005, 10:00 PM
This is a really quick template change, just an additional location for those of you looking to add google adsense to your board.
In your navbar template find (there are multiple instances of this code, use the first instance):
<if condition="$show['member']">
Above this add:
<!-- start adsense code -->
<td class="alt2">
Your adsense code
</td>
<!-- /end adsense code -->
Thats it, your all done :)
Hope this helps someone out, I am far from a coder, however, wanted to atleast attempt to give back to the community :) If you happen to use, please CLICK INSTALL
AshokForums.com
12-10-2005, 10:04 PM
Installed thanks :)
dieselpowered
12-10-2005, 10:15 PM
Installed thanks :)
Glad it was something you could use :)
Qwest
12-11-2005, 01:54 AM
Installed thanks :)
on a phpbb board?
Xplorer4x4
12-11-2005, 02:08 AM
I just used the Adsence after first post hack minues the <if> condition, and spacers, like so:
<div style="padding:0px 0px $stylevar[cellpadding]px 0px">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="thead" align="left">Sponsored Links
</tr>
<tr>
<td class="alt1" align="center">
<adsense code here>
</if>
</td>
</tr>
</table>
</div>
Link is in sig for an example. ;)
BTW Technically your mod edits the breadcrubm i believe. :p
ugmphelon
12-11-2005, 08:21 AM
doesnt work at all for me
imranbaig
12-11-2005, 11:23 AM
nice,.. Im going to use it on my forums,..
steven s
12-11-2005, 11:24 AM
doesnt work at all for me
<if condition="$show['member']"> is used several times in the navbar template. You must place your adsense before the first <if condition="$show['member']">
Mine looks like:
<div class="navbar" style="font-size:10pt"><a href="$vboptions[forumhome].php$session[sessionurl_q]" accesskey="1"><img class="inlineimg" src="$stylevar[imgdir_misc]/navbits_start.gif" alt="" border="0" /></a> <strong>$vboptions</strong></div>
</if>
</td>
<!-- google ads -->
<td class="alt2" valign="top" nowrap="nowrap">
<script type="text/javascript"><!--
google_ad_client = "";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- /google ads -->
[B]<if condition="$show['member']">
<td class="alt2" valign="top" nowrap="nowrap">
<div class="smallfont">
Snake
12-11-2005, 11:35 AM
Good idea there!
dieselpowered
12-11-2005, 03:43 PM
doesnt work at all for me
Not to ask the obvious, however, do you have a google adsense account? As mentioned, you are looking for the first instance of <if condition="$show['member']">
Let me know :)
ugmphelon
12-11-2005, 07:33 PM
yes i do, but i also have the "double navbar" feature, but blah. I donno.
ugmphelon
12-11-2005, 07:39 PM
got it, my code is alot diff. thanks
/me installs
mholtum
12-12-2005, 12:41 AM
easy money.. Nice job Mike!
dieselpowered
12-12-2005, 04:06 AM
easy money.. Nice job Mike!
Thanks Mike :)
bluecat
12-12-2005, 04:55 AM
Pretty slick. ;)
edbri871
12-12-2005, 05:11 AM
This is interesting as weve had our Google in the Nav bar for a ver long time now although hadnt thought of it to be a hack. Its was just a thought as that space always looked unused to me so one of the admins put it there. Of course it changes size based on screen resolution also...
dieselpowered
12-12-2005, 05:25 AM
This is interesting as weve had our Google in the Nav bar for a ver long time now although hadnt thought of it to be a hack. Its was just a thought as that space always looked unused to me so one of the admins put it there. Of course it changes size based on screen resolution also...
You actually have it under your navbar and above it. Regardless, this is in no way some sort of special super secret hack, it was simply meant as another alternative to adsense placement. :)
dieselpowered
12-12-2005, 05:28 AM
Pretty slick. ;)
Nice site you have there :)
edbri871
12-12-2005, 06:31 AM
You actually have it under your navbar and above it. Regardless, this is in no way some sort of special super secret hack, it was simply meant as another alternative to adsense placement. :)
Not the right one and also I wasnt putting this down its a great alternative...
MrNase
12-12-2005, 11:30 AM
Where did you get THAT idea from :D
I'am using this for 4 months now ;)
steven s
12-12-2005, 11:54 AM
Where did you get THAT idea from :D
I'am using this for 4 months now ;)I've been using it for a few months too. I did not want my page to be any taller and it looked like wasted real estate anyway.
I also use an add in the forumdisplay, but it hasn't been doing well.
dieselpowered
12-12-2005, 02:42 PM
Not the right one and also I wasnt putting this down its a great alternative...
Oh I did not think you were :)
dieselpowered
12-12-2005, 02:43 PM
Where did you get THAT idea from :D
I'am using this for 4 months now ;)
LOL I really do not know...was bored and thought I would mess around in the templates on my dev board :)
CSS59
12-20-2005, 02:02 AM
can you help me arange it like this please?
993ti
12-20-2005, 10:21 PM
How to show it only on the portal, forum and topic pages?
I don't like it on search pages (also against ToS).
CSS59
12-31-2005, 05:19 PM
can you help me arange it like this please?
so noone knows how to do this?
The Chief
01-16-2006, 02:54 AM
installed it, its awesome and looks great ;)
* The Chief clicks install
mholtum
01-16-2006, 06:03 AM
Great trick Mike.. I love it!
ba3698
01-24-2006, 10:49 AM
I think this might be against TOS..."No Google ad may be placed on any non-content-based pages." as this ad will show up on reply/login pages etc. which have no content.
I think a link unit might be ok though.
linkwavescom
03-19-2006, 02:37 AM
<font color="Red">work good </font>
mattyk72
03-27-2006, 01:36 AM
does anyone know if this is a TOS violation??
Any way to have it turn off in non-content pages?
Magle
03-30-2006, 06:59 PM
Any way to have it turn off in non-content pages?
Yes, simply add this code before the hack:
<if condition="(THIS_SCRIPT == 'forumdisplay' OR THIS_SCRIPT == 'showthread' OR THIS_SCRIPT == 'index')">
and this one after: </if>
Now it only shows up on the content pages - thus, no TOS violtation :)
pbradish
04-04-2006, 04:54 PM
Great mod, thank you :)
shortbus1662
04-06-2006, 07:18 PM
it is no longer a TOS violation from what I understand.
I believe the modified the TOS to better work with forums.
mattyk72
04-10-2006, 06:01 PM
Yes, simply add this code before the hack:
<if condition="(THIS_SCRIPT == 'forumdisplay' OR THIS_SCRIPT == 'showthread' OR THIS_SCRIPT == 'index')">
and this one after: </if>
Now it only shows up on the content pages - thus, no TOS violtation :)
thank you so much!
Better to be safe than sorry with Google I say.
thanks again
BlueDevil98
05-13-2006, 01:08 PM
I have vbadvanced and vblinks, so I did
<if condition="(THIS_SCRIPT == 'newthread')">
<else />
before the code suggested
and
</if>
after. That way it shows on all the vbadvanced pages too. Are there other pages that google wouldn't approve of that I should be excluding?
Dr.Viggy
05-14-2006, 09:03 PM
<if condition="is_member_of($bbuserinfo, 6)">ADSENSE CODE HERE</if>
here's a little something to show the adsense for only the usergroups you want. Just change the "6" to the usergroups that you want to see it (separated by commas)
Harley D
08-04-2006, 04:27 PM
THANKS >clicks install<
Darwa
08-08-2006, 07:44 AM
I'm missing something silly here. Please help :)
This is the complete code from my header. Where am I going wrong?
<!-- logo -->
<a name="top"></a>
<table border="0" width="90%" cellpadding="0" cellspacing="0" align="center" background="$stylevar[imgdir_misc]/head_back.gif">
<tr>
<td align="left" valign="top"><img src="$stylevar[imgdir_misc]/head_left.gif" alt="" /></td>
<td align="right" valign="middle"><img src="$stylevar[imgdir_misc]/banner.gif" alt="" /></td>
<td align="$stylevar[center]">
</td>
</tr>
</table>
<!-- /logo -->
<!-- Navigation bar -->
<table width="90%" style="background-image:url($stylevar[imgdir_misc]/nav.gif)" align="center" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top" height="45">
<table width="50%" align="right" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" width="102" height="45"><a href="$vboptions[forumhome].php$session[sessionurl_q]" accesskey="1"><img src="$stylevar[imgdir_misc]/nav_home.gif" width="102" height="45" border="0" alt="" /></a></td>
<if condition="$show['registerbutton']">
<td width="102" height="45"><a href="register.php$session[sessionurl_q]" rel="nofollow"><img src="$stylevar[imgdir_misc]/nav_reg.gif" width="102" height="45" border="0" alt="" /></a></td>
<else />
<td width="102" height="45" id="usercptools"><a href="$show[nojs_link]#usercptools"><img src="$stylevar[imgdir_misc]/nav_link.gif" width="102" height="45" border="0" alt="" /></a><script type="text/javascript"> vbmenu_register("usercptools" ,1); </script></td>
</if>
<td align="left" valign="top" width="102" height="45"><a href="memberlist.php$session[sessionurl_q]"><img src="$stylevar[imgdir_misc]/nav_member.gif" width="102" height="45" border="0" alt="" /></a></td>
<td align="left" valign="top" width="102" height="45"><a href="usercp.php$session[sessionurl_q]"><img src="$stylevar[imgdir_misc]/nav_usercp.gif" width="102" height="45" border="0" alt="" /></a></td>
<td align="left" valign="top" width="102" height="45"><a href="calendar.php$session[sessionurl_q]"><img src="$stylevar[imgdir_misc]/nav_cal.gif" width="102" height="45" border="0" alt="" /></a></td>
<td align="left" valign="top" width="102" height="45" id="navbar_search"><a href="search.php$session[sessionurl_q]" accesskey="4" rel="nofollow"><img src="$stylevar[imgdir_misc]/nav_search.gif" width="102" height="45" border="0" alt="" /></a><script type="text/javascript"> vbmenu_register("navbar_search" ,1); </script></td>
<td align="left" valign="top" width="102" height="45"><a href="faq.php$session[sessionurl_q]" accesskey="5"><img src="$stylevar[imgdir_misc]/nav_faq.gif" width="102" height="45" border="0" alt="" /></a></td>
</tr>
</table>
</td>
</tr>
</table>
<if condition="$show['popups']">
<!-- NAVBAR POPUP MENUS -->
<if condition="$show['searchbuttons']">
<!-- header quick search form -->
<div class="vbmenu_popup" id="navbar_search_menu" style="display:none">
<table cellpadding="4" cellspacing="1" border="0">
<tr>
<td class="thead">$vbphrase[search_forums]</td>
</tr>
<tr>
<td class="vbmenu_option" title="nohilite">
<form action="search.php" method="post">
<input type="hidden" name="do" value="process" />
<input type="hidden" name="showposts" value="0" />
<input type="hidden" name="quicksearch" value="1" />
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="text" class="bginput" name="query" size="20" /> $gobutton<br />
</form>
</td>
</tr>
<tr>
<td class="vbmenu_option"><a href="search.php$session[sessionurl_q]" accesskey="4" rel="nofollow">$vbphrase[advanced_search]:</a></td>
</tr>
<!-- start adsense code -->
<td class="alt2">
<script type="text/javascript"><!--
google_ad_client = "pub-3443198473457595";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "4C4C4C";
google_color_bg = "333333";
google_color_link = "FFFF66";
google_color_text = "B47B10";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
<!-- /end adsense code -->
<if condition="$show['member']">
<tr>
<td class="vbmenu_option"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]:</a></td>
</tr>
<else />
<tr>
<td class="vbmenu_option"><a href="search.php?$session[sessionurl]do=getdaily" accesskey="2">$vbphrase[todays_posts]:</a></td>
</tr>
</if>
</table>
</div>
<!-- / header quick search form -->
</if>
<if condition="$show['member']">
<!-- user cp tools menu -->
<div class="vbmenu_popup" id="usercptools_menu" style="display:none">
<table cellpadding="4" cellspacing="1" border="0">
<tr><td class="thead">$vbphrase[quick_links]</td></tr>
<if condition="$vboptions['enablesearches']"><tr><td class="vbmenu_option"><a href="search.php?$session[sessionurl]do=getdaily">$vbphrase[todays_posts]</a></td></tr></if>
<tr><td class="vbmenu_option"><a href="forumdisplay.php?$session[sessionurl]do=markread">$vbphrase[mark_forums_read]</a></td></tr>
<tr><td class="vbmenu_option"><a href="#" onclick="window.open('misc.php?$session[sessionurl]do=buddylist&focus=1','buddylist','statusbar=no,me nubar=no,toolbar=no,scrollbars=yes,resizable=yes,w idth=250,height=300'); return false;">$vbphrase[open_buddy_list]</a></td></tr>
<tr><td class="thead"><a href="usercp.php$session[sessionurl_q]">$vbphrase[user_control_panel]</a></td></tr>
<if condition="$show['siglink']"><tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=editsignature">$vbphrase[edit_signature]</a></td></tr></if>
<!--<if condition="$show['avatarlink']"><tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=editavatar">$vbphrase[edit_avatar]</a></td></tr></if>-->
<tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=editprofile">$vbphrase[edit_profile]</a></td></tr>
<tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=editoptions">$vbphrase[edit_options]</a></td></tr>
<tr><td class="thead">$vbphrase[miscellaneous]</td></tr>
<if condition="$show['pmstats']"><tr><td class="vbmenu_option"><a href="private.php$session[sessionurl_q]" rel="nofollow">$vbphrase[private_messages]</a></td></tr></if>
<tr><td class="vbmenu_option"><a href="subscription.php$session[sessionurl_q]" rel="nofollow">$vbphrase[subscribed_threads]</a></td></tr>
<tr><td class="vbmenu_option"><a href="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$vbphrase[my_profile]</a></td></tr>
<if condition="$show['wollink']"><tr><td class="vbmenu_option"><a href="online.php$session[sessionurl_q]">$vbphrase[whos_online]</a></td></tr></if>
<tr><td class="vbmenu_option"><a href="billspaypal.php">Donate!</a></td></tr>
</table>
</div>
<!-- / user cp tools menu -->
</if>
<!-- / NAVBAR POPUP MENUS -->
<!-- PAGENAV POPUP -->
<div class="vbmenu_popup" id="pagenav_menu" style="display:none">
<table cellpadding="4" cellspacing="1" border="0">
<tr>
<td class="thead" nowrap="nowrap">$vbphrase[go_to_page]</td>
</tr>
<tr>
<td class="vbmenu_option" title="nohilite">
<form action="$vboptions[forumhome].php" method="get" onsubmit="return this.gotopage()" id="pagenav_form">
<input type="text" class="bginput" id="pagenav_itxt" style="font-size:11px" size="4" />
<input type="button" class="button" id="pagenav_ibtn" value="$vbphrase[go]" />
</form>
</td>
</tr>
</table>
</div>
<!-- / PAGENAV POPUP -->
</if>
<!-- / Navagation bar -->
<!-- content table -->
$spacer_open
$_phpinclude_output
Thanks :)
Darwa
08-09-2006, 01:07 AM
I found that by inserting the code before the second mention of <if condition="$show['member']"> and not the first, would make something appear, but not where this threads screenshot show it.
I'll leave it 'as is' for now at www.hairyjedi.com in the hope that someone can come to my aid and explain what's going wrong.
Thanks.
Oddjob
12-24-2006, 02:56 AM
This works perfect in 3.6.4 in case anyone wanted to know.
RichieBoy67
02-21-2007, 12:46 AM
It does not look right in firefix with the guest message added.... Either a conditional should be used to only let logged in members see it or maybe a conditional to stop firefox from seeing it....
seangworld
02-21-2007, 08:30 AM
in the instructions, you stated to use the first instance, i (and prolly others) actually needed to use the SECOND instance. just in case someone gets stuck.
it might be cuz i have the double navbar.
*clicks install*
RichieBoy67
02-24-2007, 12:41 PM
It works perfectly when members are logged in but when a guest views unfortunatly the ads throw off my welcome template... I think it kind of defeats the purpose for me to use a conditional so only members can see it...
Has anyone else had this problem?? Go to your site while not being logged in and see what the ads look like or go to my site www.talkandmore.net .. I have taken the ads out but you will see my guest message and know what I mean..
Any correction for this?
Thanks
Hi,
the Google AdSense in forumhome appear at the left. i need it at center.
How can i do it?
sinistergaming
05-23-2007, 08:43 PM
In the FORUMHOME template find this code: $navbar
Or Add It to The Very End Of Your NAVBAR Template
Add this below it:
<!-- custom block start -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tbody>
<tr>
<td class="tcat"><a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('custom_block')">
<img id="collapseimg_custom_block" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_custom_block].gif" alt="" border="0" /></a>
<!-- title start -->
Title goes here
<!-- title end -->
</td>
</tr>
</tbody>
<tbody id="collapseobj_custom_block" style="$vbcollapse[collapseobj_custom_block]">
<tr>
<td class="alt2">
<!-- code start -->
Add your code here
<!-- code end -->
</td>
</tr>
</tbody>
</table>
<br />
<!-- custom block end -->
This also XHTML and CSS valid and will keep your homepage validated OK.
change this in the code: to "1" or "2" for colour you prefer for block background colour.
<td class="alt2">
If you don't want the block to be collasible, use this instead:
<!-- custom block start -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tbody>
<tr>
<td class="tcat">
<!-- title start -->
Title goes here
<!-- title end -->
</td>
</tr>
<tr>
<td class="alt2">
<!-- code start -->
Add your code here
<!-- code end -->
</td>
</tr>
</tbody>
</table>
<br />
<!-- custom block end -->
Realbigsource
03-02-2008, 09:38 PM
where do I find the Nave Bar?
Serkan Yılmaz
03-22-2008, 07:58 PM
Teşekkurler arkadaşlar(Thank you)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.