Tutorials Blog
Hosting
Software
Dolphin Tips
Help Forums FREE Mods
Licensing
People
Donate
News
Search
  •  
 
 
Tutorial
10.07.2008 00:00    Categories: Dolphin     

This is based on Dolphin 6.1.x code.

You can ad Google Adsense to the top area of a Blog Post. Display Google Adsense at the bottom of a Blog Post or both.

You should be familiar with Google Adsense, and will need to obviously create the ad in your Google account. Make sure you choose one that will actually fit, and change the text colors to match your site in your account. This example is a Google Text Only Ad size 468x60 horizontal.

I also used <center> and </center> tags to center it, and put some <br> line breaks in. You may have to play around with the <br> line breaks to suit your needs.

Screen Shot Before Top of Blog no Google Adsense:

Top of Blog Before


Screen Shot After Top of Blog with Google Adsense:

Top of Blog After


Screen Shot Before Bottom of Blog no Google Adsense:

Bottom of Blog Before


Screen Shot After Bottom of Blog with Google Adsense:

Bottom of Blog After



First Backup to your local pc:
/inc/classes/BxDolBlogs.php



For the Top Area of a Blog Post Find:

        $sBlogPosts .= <<<EOF
<div style="margin-bottom:10px;">
    <div>
        <div class="cls_res_thumb">
            {$sPostCaptionHref}
        </div>
        {$sActions}
        <div class="clear_both"></div>
    </div>
    <div class="fr_small_gray_centered">
        {$sAuthor}
        <span style="vertical-align:middle;"><img src="{$site['icons']}clock.gif" class="marg_icon" alt="{$sDateTime}" /></span><span class="margined">{$sDateTime}</span>
        <span style="vertical-align:middle;"><img src="{$site['icons']}add_comment.gif" class="marg_icon" alt="" /></span><span class="margined">{$aResSQL['CountComments']} {$sCommentsC}</span>
        <span style="vertical-align:middle;"><img src="{$site['icons']}folder_small.png" class="marg_icon" alt="{$sCategoryName}" /></span>
        <a href="{$sOwnerCatLink}">
            {$sCategoryName}
        </a>
    </div>
    <div class="blog_text{$sFriendStyle}">
        {$sPostPhoto}
        {$sPostText}
    </div>
    <div class="clear_both"></div>
    {$sTags}
</div>
EOF;



Change to:

        $sBlogPosts .= <<<EOF
<div style="margin-bottom:10px;">

<center>
<script type="text/javascript"><!--
google_ad_client = "pub-6466712554337147";
/* 468x60, created 10/6/08 */
google_ad_slot = "7998617648";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center><br>


    <div>
        <div class="cls_res_thumb">
            {$sPostCaptionHref}
        </div>
        {$sActions}
        <div class="clear_both"></div>
    </div>
    <div class="fr_small_gray_centered">
        {$sAuthor}
        <span style="vertical-align:middle;"><img src="{$site['icons']}clock.gif" class="marg_icon" alt="{$sDateTime}" /></span><span class="margined">{$sDateTime}</span>
        <span style="vertical-align:middle;"><img src="{$site['icons']}add_comment.gif" class="marg_icon" alt="" /></span><span class="margined">{$aResSQL['CountComments']} {$sCommentsC}</span>
        <span style="vertical-align:middle;"><img src="{$site['icons']}folder_small.png" class="marg_icon" alt="{$sCategoryName}" /></span>
        <a href="{$sOwnerCatLink}">
            {$sCategoryName}
        </a>
    </div>
    <div class="blog_text{$sFriendStyle}">
        {$sPostPhoto}
        {$sPostText}
    </div>
    <div class="clear_both"></div>
    {$sTags}
</div>
EOF;



For the Bottom Area of a Blog Post Find:
EOF;
        }

        $sAuthor = '';

        //339933 color green
        $sPostText = ($iView==2) ? $aResSQL['PostText'] : $aResSQL['PostText'];

        if ($iView==2) $sActions='';
        $sTags = <<<EOF
<div class="fr_small_gray_centered">
    <span style="vertical-align:middle;"><img src="{$site['icons']}tag_small.png" class="marg_icon" alt="{$sTagsC}" /></span>{$sTagsC}:&nbsp;{$sTagsHrefs}
</div>
EOF;

        $sFriendStyle = "";


Change to:
EOF;
        }

        $sAuthor = '';

        //339933 color green
        $sPostText = ($iView==2) ? $aResSQL['PostText'] : $aResSQL['PostText'];

        if ($iView==2) $sActions='';
        $sTags = <<<EOF
<div class="fr_small_gray_centered">
    <span style="vertical-align:middle;"><img src="{$site['icons']}tag_small.png" class="marg_icon" alt="{$sTagsC}" /></span>{$sTagsC}:&nbsp;{$sTagsHrefs}
</div>

<br><center>
<script type="text/javascript"><!--
google_ad_client = "pub-6466712554337147";
/* 468x60, created 10/6/08 */
google_ad_slot = "7998617648";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center><br>


EOF;

        $sFriendStyle = "";



Now obviously the code you are inserting is your Google Adsense code in the above examples I used my code:

<br><center>
<script type="text/javascript"><!--
google_ad_client = "pub-6466712554337147";
/* 468x60, created 10/6/08 */
google_ad_slot = "7998617648";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center><br>

***Be sure this is replaced with your actual Google Adsense Account code so you get credit for clicks on your site not me***

Finally save the file over-writting the original.

Refresh a blog post to see the changes.

*Note: Sometimes Google Adsense can take up to 10 minutes to show/display if you have just created the ad in your Google Account.

Problems: Restore original backup file:
/inc/classes/BxDolBlogs.php

You were instructed to download to your local pc prior to attempting this.

Good Luck!!

 
Share It