Google AdSense in SMF, various positions...

Started by Moonray, September 25, 2005, 11:46:56 PM

Previous topic - Next topic

remi_naija

I'm trying to add adsense codes to Oxygen11 template and just realized Ithat it does not have the display_temlplate.php file. which file do i modify to add adsense before the first, and the last post?

remi_naija

#201
Quote from: Moonray on September 25, 2005, 11:46:56 PM
Google AdSense and SMF:


--------
EDIT:
Please check my new post in this thread here.
Have made new changes and will be releasing them soon. Need your feedback on any further improvements.
Thanks
--------
All information is now being compiled at this thread in Joomlaspan forum also.


Position 1: After 1st post

File to be modded: Display.template.php

Find this in the file:

// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']))
echo '
<hr width="100%" size="1" class="hrcolor" />
<div style="overflow: auto; width: 100%; padding-bottom: 3px;" class="signature">', $message['member']['signature'], '</div>';

echo '
</td>
</tr>
</table>
</td></tr>
</table>
</td></tr>';
[color=red]}[/color]


Insert this code, just ABOVE the "}" indicated in red, above.


if ($message['id'] == $context['first_message'])
echo '
<div align="center">
        <script type="text/javascript"><!--
        google_ad_client = "pub-youradsenseID";
        google_ad_width = 468;
        google_ad_height = 60;
        google_ad_format = "468x60_as";
        google_ad_type = "text";
        google_ad_channel ="yourCHANNEL";
        google_color_border = "577494";
        google_color_bg = "577494";
        google_color_link = "FFFFFF";
        google_color_url = "999999";
        google_color_text = "EFEFEF";
        //--></script>
        <script type="text/javascript"
          src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
        </script>
  </div>
';


PS: Do not forget to put in your AdSense ID.

Demo:
Mediscuss: Medical education Discussion forum


I have Just followed the steps on position 1 and i get an error message in the status bar: "Done but with error on page" in Internet explorer. Also, the ad appears on top of the first post, in between the Name of poster and content.

see here www.naijaclan.com

taimurkazmi

Quote from: Moonray on September 25, 2005, 11:46:56 PM
Google AdSense and SMF:


--------
EDIT:
Please check my new post in this thread here.
Have made new changes and will be releasing them soon. Need your feedback on any further improvements.
Thanks
--------
All information is now being compiled at this thread in Joomlaspan forum [nofollow] also.


Position 1: After 1st post

File to be modded: Display.template.php

Find this in the file:

// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']))
echo '
<hr width="100%" size="1" class="hrcolor" />
<div style="overflow: auto; width: 100%; padding-bottom: 3px;" class="signature">', $message['member']['signature'], '</div>';

echo '
</td>
</tr>
</table>
</td></tr>
</table>
</td></tr>';
[color=red]}[/color]


Insert this code, just ABOVE the "}" indicated in red, above.


if ($message['id'] == $context['first_message'])
echo '
<div align="center">
        <script type="text/javascript"><!--
        google_ad_client = "pub-youradsenseID";
        google_ad_width = 468;
        google_ad_height = 60;
        google_ad_format = "468x60_as";
        google_ad_type = "text";
        google_ad_channel ="yourCHANNEL";
        google_color_border = "577494";
        google_color_bg = "577494";
        google_color_link = "FFFFFF";
        google_color_url = "999999";
        google_color_text = "EFEFEF";
        //--></script>
        <script type="text/javascript"
          src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
        </script>
  </div>
';


PS: Do not forget to put in your AdSense ID.

Demo:
Mediscuss: Medical education Discussion forum [nofollow]

Position 2: Top of all pages, mimicking a category! (High CTR)

File to be modded: index.template.php

This example is specifically for the smfaqua theme. Necessary modifications may be done for other themes also.


Find this in the file:

// The main content should go here.  A table is used because IE 6 just can't handle a div.


Insert this code, just BELOW the code given above.


echo '
<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>


<td style="padding: 1ex 1px 2ex 1px;" width="100%" valign="top">
<div class="tborder">
<table border="0" width="100%" cellspacing="1" cellpadding="5" height="72">
<tr>
<td  colspan="4" class="catbg" height="18"><img src="/Themes/smfaqua/images/post_old.gif" class="midimage" alt="No New Posts" title="No New Posts" border="0" />
<font size="1">Sponsored Links</font>
</td>
</tr>
<tr class="topicbg1">
<td class="topicbg1" align="center" valign="middle"><img src="/Themes/smfaqua/images/on.gif"  border="0" /></td>
<td class="topicbg1" align="left" width="70%">
<div style="float:right;text-align:right;">
    <a href="index.php?action=post;board=1.0"><img src="/Themes/smfaqua/images/n.gif" alt="n" border="0" title="Start new topic" /></a>
    <a href="index.php?action=markasread;sa=board;board=1.0"><img src="/Themes/smfaqua/images/m.gif" alt="m" border="0" title="Mark Topics as Read for this Forum" /></a>
    <a href="index.php?action=notifyboard;sa=on;board=1.0;sesc=233047cc065c2e23891b5ce3e234432f"><img src="/Themes/smfaqua/images/z.gif" alt="z" border="0" title="Notify of replies" /></a>
</div>
<script type="text/javascript"><!--
    google_ad_client = "pub-youradsenseID";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
google_alternate_color = "F1F4F9"
    google_ad_type = "text";
    google_ad_channel ="youadsenseCHANNEL";
    google_color_border = "F1F4F9";
    google_color_bg = "F1F4F9";
    google_color_link = "094899";
    google_color_url = "787878";
    google_color_text = "333333";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
</td>
<td class="topicbg1" valign="middle" align="center" style="width: 10%;" nowrap="nowrap">
<span class="smalltext">1 Post in<br/>1 Topic</span></td>
<td class="topicbg1" valign="middle" width="30%" nowrap="nowrap">
<span class="smalltext"><img border="0" src="/Themes/smfaqua/images/f.gif" align="middle" title="" alt="" />Posted <b>Today</b>,at 12:00:00 AM<br>by <u>Google</u></span></td>
</tr>
<tbody class="sep_display"><tr style="height:5px;"><td style="height:5px;padding:0;" colspan="4" class="catbg"></td></tr><tr style="padding:0;"><td style="padding:0;" colspan="4"><div class="catsep"></div></td></tr></tbody>
</table>
</div>';


PS: Do not forget to put in your AdSense ID.

Demo:
Mediscuss: Medical education Discussion forum [nofollow]

BOTH these have been tested to work seamlessly with the smfaqua theme. Will work in all themes with very little adaptations.


Also look at this if you are interested:


Chameleon code for Google AdSense [nofollow]

Great

ne-yola

Pls I am a Newbie and i own a forum site..i need to put ads on the top and side bars and in between posts , i need help as to a step by step method to go abt it....
my forum is hosted on wbrlhosting

i know i need to get to the display.temp.php

pls how do i locate the display temp php
xpecting a prompt reply
thanks

jeffym

That's such an awesome tip .

Thanks for that. I'm going to give it a try right now.

Thanks  :)

Jeff
hxxp:www.losebeerbelly.org [nonactive]

bosunjohnson

Can someone  please give the download link for the greensense theme pls. I have check the joomlaspan site but found nothing.
Any other custom adsense ready theme is also appreciated.

ScottDB

Hi all, I would really like to have this in my forum but not sure how to do it. I would like the position 2 but in the post the: find this code is blank.

I am a bit of a newbie. Can someone explain a little better how to do this?
Thank you,
Scott

If at first you don't succeed. post and post again.

JBlaze

Quote from: ScottDB on July 12, 2009, 05:21:15 PM
Hi all, I would really like to have this in my forum but not sure how to do it. I would like the position 2 but in the post the: find this code is blank.

I am a bit of a newbie. Can someone explain a little better how to do this?

See if this helps.
Manual Installation of Mods
Jason Clemons
Former Team Member 2009 - 2012

samueliyinbo

Hello please I am using smf 1.1.10 with the dibermic theme, I can't see to find any Display.template.php. Please could you help. Thank you

Arantor

Display.template.php will be in either Themes/dilber/Display.template.php (or whatever the directory is called) or failing that it will be in Themes/default/Display.template.php.
Holder of controversial views, all of which my own.


sclark

This is exactly what i need, but i will wait until i have enough impression.

Tyrsson

PM at your own risk, some I answer, if they are interesting, some I ignore.



Arantor

Do you need any support with this, Shadow1243?
Holder of controversial views, all of which my own.


wordgeist

I'm going to try this changes and see if they work on my site

Isabelle88

a quick question, i got it to work in the first post but i was wondering is there a way to have it in every post?

the banners are small and it looks great

Arantor

Quote from: Isabelle88 on October 26, 2009, 03:14:57 PM
a quick question, i got it to work in the first post but i was wondering is there a way to have it in every post?

the banners are small and it looks great

You are not permitted by Google AdSense's TOS to have more than 3 link units in a page.
Holder of controversial views, all of which my own.


Isabelle88


Isabelle88

ok i jinxed myself, i had it perfect but then i realized i had one too many ads and i removed one, nothing to do with the code but now for the first post ad it shows the space but not the ad its self, i re did everything but nothing works

Advertisement: