Clan Adverts

Adsense inside the first post of a topic

Description: This little hack will add adsense inside the first post of each topic.
Version: 1.0
Added on: 04 May 2007
Author: floppy
Difficulty Level: Difficult
Views: 1145
Rating: 2.0 (1 Vote)
Detailed ProfileView Comments (1)

This requires edits to the following files

viewtopic.php
viewtopic_body.tpl

BE SURE TO BACKUP YOUR FILES

In modules/Forums/viewtopic.php find

Code:
        //
        // Handle anon users posting with usernames
        //


above add
Note: your adsense code will need to replace mine below.

Code:
//adsense
if($i == 0 && $current_page == 1)   {
$adsense = "<td align='center'><div align='center' valign='middle'><script type=\"text/javascript\"><!--
google_ad_client = \"pub-0139055847498612\";
google_ad_width = 250;
google_ad_height = 250;
google_ad_format = \"250x250_as\";
google_ad_type = \"text_image\";
google_ad_channel = \"\";
google_color_border = \"9EAEB6\";
google_color_bg = \"9EAEB6\";
google_color_link = \"000000\";
google_color_text = \"FFFFFF\";
google_color_url = \"000000\";
//-->
</script>
<script type=\"text/javascript\"
  src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">
</script></div></td>";
}else{
   $adsense = "";
}
//adsense


next find

Code:
'MESSAGE' => $message,


after add

Code:
'ADSENSE' => $adsense,


In themes/yourtheme/forums/viewtopic_body.tpl find

Note: this may be the most tricky part of this, depending on how your forums viewtopic is layed out.

Code:
{postrow.MESSAGE}


In that line find

Code:
</td>


After Add

Code:
{postrow.ADSENSE}