PDA

View Full Version : Google Adsense In Navbar


dieselpowered
10 Dec 2005, 21:02
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
11 Dec 2005, 00:04
Installed thanks :)

dieselpowered
11 Dec 2005, 00:15
Installed thanks :)

Glad it was something you could use :)

.Tim
11 Dec 2005, 02:45
Nice!

Qwest
11 Dec 2005, 03:54
Installed thanks :)
on a phpbb board?

Xplorer4x4
11 Dec 2005, 04:08
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
11 Dec 2005, 10:21
doesnt work at all for me

imranbaig
11 Dec 2005, 13:23
nice,.. Im going to use it on my forums,..

steven s
11 Dec 2005, 13:24
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
11 Dec 2005, 13:35
Good idea there!

dieselpowered
11 Dec 2005, 17:43
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
11 Dec 2005, 21:33
yes i do, but i also have the "double navbar" feature, but blah. I donno.

ugmphelon
11 Dec 2005, 21:39
got it, my code is alot diff. thanks

/me installs

mholtum
12 Dec 2005, 02:41
easy money.. Nice job Mike!

dieselpowered
12 Dec 2005, 06:06
easy money.. Nice job Mike!

Thanks Mike :)

bluecat
12 Dec 2005, 06:55
Pretty slick. ;)

edbri871
12 Dec 2005, 07:11
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 Dec 2005, 07:25
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 Dec 2005, 07:28
Pretty slick. ;)

Nice site you have there :)

edbri871
12 Dec 2005, 08:31
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 Dec 2005, 13:30
Where did you get THAT idea from :D

I'am using this for 4 months now ;)

steven s
12 Dec 2005, 13:54
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 Dec 2005, 16:42
Not the right one and also I wasnt putting this down its a great alternative...

Oh I did not think you were :)

dieselpowered
12 Dec 2005, 16:43
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
20 Dec 2005, 04:02
can you help me arange it like this please?

993ti
21 Dec 2005, 00:21
How to show it only on the portal, forum and topic pages?
I don't like it on search pages (also against ToS).

CSS59
31 Dec 2005, 19:19
can you help me arange it like this please?


so noone knows how to do this?

The Chief
16 Jan 2006, 04:54
installed it, its awesome and looks great ;)

/me clicks install

mholtum
16 Jan 2006, 08:03
Great trick Mike.. I love it!

ba3698
24 Jan 2006, 12:49
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
19 Mar 2006, 04:37
work good

mattyk72
27 Mar 2006, 03:36
does anyone know if this is a TOS violation??

Any way to have it turn off in non-content pages?

Magle
30 Mar 2006, 20:59
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 Apr 2006, 18:54
Great mod, thank you :)

shortbus1662
06 Apr 2006, 21:18
it is no longer a TOS violation from what I understand.

I believe the modified the TOS to better work with forums.

mattyk72
10 Apr 2006, 20:01
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
13 May 2006, 15:08
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
14 May 2006, 23:03
<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
04 Aug 2006, 18:27
THANKS >clicks install<

Darwa
08 Aug 2006, 09:44
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]">
&nbsp;
</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" />&nbsp;$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&amp;focus=1','buddylist','statusbar=no,menubar=no,toolbar=no,scrollbars =yes,resizable=yes,width=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
09 Aug 2006, 03:07
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
24 Dec 2006, 04:56
This works perfect in 3.6.4 in case anyone wanted to know.

RichieBoy67
21 Feb 2007, 02:46
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
21 Feb 2007, 10:30
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
24 Feb 2007, 14:41
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

efil
26 Feb 2007, 05:35
Hi,
the Google AdSense in forumhome appear at the left. i need it at center.

How can i do it?

sinistergaming
23 May 2007, 22:43
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
02 Mar 2008, 23:38
where do I find the Nave Bar?

Serkan Yılmaz
22 Mar 2008, 21:58
Teşekkurler arkadaşlar(Thank you)