Customizing SMF > Tips and Tricks

Adsense within first post of thread in smf 2.0 specially the core theme

(1/5) > >>

aamjad2001:
Now you can have a small, rectangular adsense ad appear within and directly beneath the content of the first post in each thread  specially in the core theme.

You can try this approach:
Find in Display.template.php:

--- Code: ---<div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>

--- End code ---

Replace the above with:

--- Code: ---<div class="inner" id="msg_', $message['id'], '"', '>';
                 if ($message['id'] == $context['first_message'])
      echo '
                        <div style="float:right; width:270px;">
                        <script type="text/javascript"><!--
                        google_ad_client = "pub-xxxxxxxxxxxxxxx";
                        /* 250x250, created 9/07/11 bforum text */
                        google_ad_slot = "xxxxxxxxxxxx";
                        google_ad_width = 250;
                        google_ad_height = 250;
                        //-->
                        </script>
                        <script type="text/javascript"
                        src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                        </script></div>';
      echo '   
               ', $message['body'], '</div>

--- End code ---

You can see the demo here:

--- Code: ---http://www.baqaians.com/bforum/general-physician-desk/myths-about-the-menstrual-periods/
--- End code ---


wilowterra:
 ;D ;D ;D ;D ;D ;D thanks

glennk:
is this possible for the bigger banners ? I want to put the large adsense banner in the first post only ??

Yoshi:
@glennk: Yes, that should be possible :)

Also, I don't want to ruin anyone's experience, but this can also be done with Ad Management Mod, AFAIK. That's a bit simpler for most users, but if you just want it there without installing big mods you can indeed use this :)

matricrsult:
Hmmm great

Navigation

[0] Message Index

[#] Next page

Go to full version