News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

adding adsense after the first and last post in Chatbubbles

Started by shishira, August 05, 2005, 07:08:48 AM

Previous topic - Next topic

shishira

need help to add google adsense code into display.template next to the first avatar and next to the last avatar in chatbubbles

my page code is this

// Show the member's signature?
if (!empty($settings['show_signature']) && empty($options['show_no_signatures']) && !empty($message['member']['signature']))
echo '
<tr><td colspan="2"><hr width="100%" size="1" class="hrcolor" /></td></tr>
<tr><td colspan="2">
<div style="overflow: auto; width: 100%;">', $message['member']['signature'], '</div></td></tr>';

echo '<tr><td align="left" valign="bottom" class="smalltext" colspan="2">' . ($settings['show_modify'] && !empty($message['modified']['name']) ? '<br />« <i>' . $txt[211] . ': ' . $message['modified']['time'] . ' ' . $txt[525] . ' ' . $message['modified']['name'] . '</i> »' : '') . '</td></tr>';
echo '<tr><td align="right" valign="bottom" class="smalltext" colspan="2">', ($context['can_report_moderator'] ? '<a href="' . $scripturl . '?action=reporttm;topic=' . $context['current_topic'] . '.' . $message['counter'] . ';msg=' . $message['id'] . '">' . $txt['rtm1'] . '</a>&nbsp;&nbsp;' : ''), '', ($context['user']['is_admin'] && !empty($message['member']['ip']) ? '<a href="' . $scripturl . '?action=trackip;searchip=' . $message['member']['ip'] . '"><img src="' . $settings['images_url'] . '/ip.gif" alt="" border="0" /> ' . $message['member']['ip'] . '</a>' : '<img src="' . $settings['images_url'] . '/ip.gif" alt="" border="0" /> ' . $txt[511]), '</td></tr>';

echo '</table>';


if (empty($settings['left_avatar_only'])) {
if ($avatarHere) {
$avatarHere = false;
echo '</td><td class="chatright"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="27" height="1" /></td></tr><tr><td class="chatbottomleft"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="27" height="23" /></td><td class="chatbottom" width="100%"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" height="23" /></td><td class="chatspeakright"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="27" height="23" /></td></tr></table>';
echo '</td><td width="100" valign="bottom">', $posterData, '</td></tr>';

} else {
$avatarHere = true;
echo '</td><td class="chatright"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="27" height="1" /></td></tr><tr><td class="chatspeakleft"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="27" height="23" /></td><td class="chatbottom" width="100%"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" height="23" /></td><td class="chatbottomright"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="27" height="23" /></td></tr></table>';
echo '</td><td width="100" valign="top">', $lastAvatar, '</td></tr>';
}
} else {
echo '</td><td class="chatright"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="27" height="1" /></td></tr><tr><td class="chatspeakleft"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="27" height="23" /></td><td class="chatbottom" width="100%"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" height="23" /></td><td class="chatbottomright"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="27" height="23" /></td></tr></table>';
echo '</td></tr>';
echo '<tr><td colspan="2"><hr width="100%" size="1" class="hrcolor" /></td></tr>';

}

$count++;
}

echo '<tr>';
if (empty($settings['left_avatar_only'])) {
if ($avatarHere) echo '<td valign="top" align="right">', $thisAvatar, '<td width="100%"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="80" height="1" /></td><td><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="80" height="1" /></td></td>';
else echo '<td><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="80" height="1" /></td><td width="100%"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="80" height="1" /></td><td valign="top">', $thisAvatar, '</td>';


    }
echo '</tr>
<tr><td style="padding: 0 0 1px 0;"></td></tr>
</table>
</div>
<a name="lastPost"></a>

<div class="tborder"><table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="margin-top: 1ex;">
<tr>
<td align="left" class="catbg" width="100%" height="30">
<table cellpadding="3" cellspacing="0" width="100%">
<tr>
<td>
<a name="bot"></a><b>', $txt[139], ':</b> ', $context['page_index'], ($modSettings['topbottomEnable'] ? $context['menu_separator'] . '<a href="#top">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/go_up.gif" alt="' . $txt['topbottom4'] . '" border="0" align="top" />' : $txt['t


what would the code be that i need to add

thanks a lot
It always takes longer than you expect, even when you take into account Hofstadter's Law.

http://shiroid.com
http://bangaloreforums.com

shishira

tried adding the code from http://www.simplemachines.org/community/index.php?topic=36642.0

as this

Quoteif (empty($settings['left_avatar_only'])) {
         if ($avatarHere) {
            $avatarHere = false;
            echo '</td><td class="chatright"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="27" height="1" /></td></tr><tr><td class="chatbottomleft"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="27" height="23" /></td><td class="chatbottom" width="100%"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" height="23" /></td><td class="chatspeakright"><img src="', $settings['images_url'], '/layout/spacer.gif" alt="" width="27" height="23" /></td></tr></table>';
            echo '</td><td width="100" valign="bottom">', $posterData, '</td></tr>';

if ( $context['num_replies'] % $modSettings['defaultMaxTopics'] > 1 ){
echo '<tr><td colspan="2" class="titlebg"   align="right">
   <script type="text/javascript"><!--
   google_ad_client = "pub-0925855890521994";
   google_ad_width = 468;
   google_ad_height = 60;
   google_ad_format = "468x60_as";
   google_ad_type = "text_image";
   google_ad_channel ="";
   google_color_border = "F7F7F7";
   google_color_bg = "F7F7F7";
   google_color_link = "FF664A";
   google_color_url = "0066FF";
   google_color_text = "000000";
   //--></script>
   <script type="text/javascript"
     src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>'; }
if ( $context['num_replies'] > 1 ){
echo '<tr><td colspan="2" class="titlebg"   align="right">
   <script type="text/javascript"><!--
   google_ad_client = "pub-0925855890521994";
   google_ad_width = 468;
   google_ad_height = 15;
   google_ad_format = "468x15_0ads_al";
   google_ad_channel ="";
   google_color_border = "F7F7F7";
   google_color_bg = "F7F7F7";
   google_color_link = "FF664A";
   google_color_url = "0066FF";
   google_color_text = "000000";
   //--></script>
   <script type="text/javascript"
     src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>';}
         } else {
            $avatarHere = true;
            echo '



nearly there but not yet

thanks
It always takes longer than you expect, even when you take into account Hofstadter's Law.

http://shiroid.com
http://bangaloreforums.com

[Unknown]

I'm afraid the code necessary may be specific to your theme, which wasn't developed by anyone who frequents this board.

-[Unknown]

shishira

The code is from the display.template.php from the chatbubbles theme by spaceant
It always takes longer than you expect, even when you take into account Hofstadter's Law.

http://shiroid.com
http://bangaloreforums.com

yellow1912

Im also trying to do this, it'd be great if some of you did it and could post the code here. Thanksss a ton
My SMF forum ^^
An Ecommerce site I help to build

yellow1912

Okie, it took me lots of time to figure out how to do it (how noob i am :(( )
And the code isnt quite perfect yet, if you find bugs or whatever, please do tell me

Pls note:
1. I havent had time to change all url to relative url, you MUST change them all to work correctly. And change the google id also
2. The code below only adds adsense after 1st post, not the last one. I think it's kinda ugly to do that

Okie, now how to do it:
Find:
$count++;
Add after
            //---------------------------------
   if ($count==1)
   {
   $avatarHere = true;
   
   $count++;
   echo '
         <tr><td width="100" valign="bottom"><table width="100%" cellpadding="0" cellspacing="0"><tr><td><b>GoogleAds</b></td></tr><tr><td class="smalltext">Sponsor</td></tr><tr><td class="smalltext">Expert</td></tr><tr><td><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/staradmin.gif" alt="*" border="0" /><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/staradmin.gif" alt="*" border="0" /><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/staradmin.gif" alt="*" border="0" /><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/staradmin.gif" alt="*" border="0" /><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/staradmin.gif" alt="*" border="0" /></td></tr><tr><td class="smalltext">Karma: 6</td></tr><tr><td><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/useron.gif" alt="Online" border="0" align="middle" /><span class="smalltext"> Online</span></td></tr><tr><td>Posts: 120</td></tr></table></td><td><table border="0" width="100%" cellpadding="0" cellspacing="0"><tr><td class="chattopleft"><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/layout/spacer.gif" alt="" width="32" height="9" /></td><td class="chattop" width="100%"><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/layout/spacer.gif" alt="" height="9" /></td><td class="chattopright"><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/layout/spacer.gif" alt="" width="32" height="9" /></td></tr><tr><td class="chatleft"><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/layout/spacer.gif" alt="" width="32" height="1" /></td><td class="chatinside" width="100%"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td class="smalltext" valign="bottom" width="1000">« <b>Today</b> at 01:40:03 PM »</td><td align="right" valign="bottom" height="20" nowrap="nowrap" style="font-size: smaller;"></td></tr><tr><td colspan="2"><hr width="100%" size="1" class="hrcolor" /></td></tr><tr><td colspan="2"><script type="text/javascript"><!--
google_ad_client = "pub-5408150360988280";
google_ad_width = 400;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "ffffcc";
google_color_bg = "ffffcc";
google_color_link = "000000";
google_color_url = "000000";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td></td></tr><tr><td align="left" valign="bottom" class="smalltext" colspan="2"></td></tr><tr><td align="right" valign="bottom" class="smalltext" colspan="2"><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/ip.gif" alt="" border="0" /> Logged</td></tr></table></td><td class="chatright"><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/layout/spacer.gif" alt="" width="27" height="1" /></td></tr><tr><td class="chatspeakleft"><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/layout/spacer.gif" alt="" width="27" height="23" /></td><td class="chatbottom" width="100%"><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/layout/spacer.gif" alt="" height="23" /></td><td class="chatbottomright"><img src="http://www.shareparadise.net/community/Themes/chatbubbles/images/layout/spacer.gif" alt="" width="27" height="23" /></td></tr></table></td><td width="100" valign="top">'.$thisAvatar.'</td></tr>';
   $thisAvatar = '<img src="'.$settings['images_url']. '/google.jpg"'.'alt="" class="avatar" border="0"';
   }
   
   //-----------------------------------

It should work then! You can see the demo here:
http://www.shareparadise.net/index.php?option=com_smf&Itemid=26&topic=1.0

(I believe this room is open. If not you can login as; testing:testing)
My SMF forum ^^
An Ecommerce site I help to build

shishira

tried out your code yellow works with out a hitch thanks for the same
It always takes longer than you expect, even when you take into account Hofstadter's Law.

http://shiroid.com
http://bangaloreforums.com

rbrown3rd

Works for me too.  Wish we could place the Adsense ads in the footer or header of this theme too.  The Chatbubble theme is super.  Very imaginitive and clever.

Advertisement: