Adding AdSense to Simple PHP Blog 
Wednesday, August 15, 2007, 01:57 AM
Posted by Administrator
As you can see, AdSense is now available on my blog. See the ads on the upper-left corner of the site?

Signing up for AdSense is easy. Just head on over to www.google.com/adsense and register as a new user. Once you are approved, which may take up to 48 hours (much sooner in my case), you can begin adding AdSense code to your site.

To show the AdSense code in my site, I had to change three files included as part of the Simple PHP Blog installation. One of them, themes/modern/themes.php, was relatively simple to change. After the line:

echo( "\n<!-- SIDEBAR MENU BEGIN -->\n" );


I added the following:

//ADSENSE
theme_menu_block( menu_display_adsense(), "ADSENSE" );


This added the AdSense block to the very top of the sidebar. If you wanted to make it appear lower in the sidebar, simply move the above two lines of code wherever you want it to be placed.

The bulk of the changes occurred in the scripts/sb_themes.php file. I created a new function:

function menu_display_adsense() {
// Title: Adsense mod for sPhpBlog
// Author: Bill

// Returns adsense picture/script
global $lang_string, $user_colors;

$str = '<script type="text/javascript"><!--' . "\n";

// *** Make sure you use your own pub number here! ***
$str .= 'google_ad_client = "pub-xxxxxxxxxxxxxxxx";' . "\n";
// *** Make sure you use your own pub number here! ***

$str .= 'google_ad_width = 160;' . "\n";
$str .= 'google_ad_height = 600;' . "\n";
$str .= 'google_ad_format = "160x600_as";' . "\n";
$str .= 'google_ad_type = "text_image";' . "\n";
$str .= 'google_ad_channel = "";' . "\n";
$str .= 'google_color_border = "' . $user_colors[ 'menu_title_bg' ] . "\";\n";
$str .= 'google_color_bg = "' . $user_colors[ 'menu_bg' ] . "\";\n";
$str .= 'google_color_link = "' . $user_colors[ 'link_reg_color' ] . "\";\n";
$str .= 'google_color_text = "' . $user_colors[ 'menu_text' ] . "\";\n";
$str .= 'google_color_url = "' . $user_colors[ 'menu_title_text' ] . "\";\n";
$str .= '//-->' . "\n";
$str .= '</script>' . "\n";
$str .= '<script type="text/javascript"' . "\n";
$str .= ' src="http://pagead2.googlesyndication.com/pagead/show_ads.js">' . "\n";
$str .= '</script>' . "\n";
$result = array();
$result[ 'title' ] = $lang_string[ 'menu_adsense' ];
$result[ 'content' ] = $str;

return ( $result );
}

The nice thing about this function is the integration of the theme colors. This way, if you change the colors of your theme in the future, the AdSense colors will change to match your theme. Note: to find your pub number, use the AdSense site to generate some example code. You should see the pub number in the generated code.

Finally the last file I changed was languages/english/strings.php. I added a new line:

$lang_string['menu_adsense'] = "";

amongst the other $lang_string definitions found in the file. Note that there is nothing between the quotes. You could add a title to the AdSense block by adding one between the quotes, but I think it looks better with no text.

That's it! The modern theme should now automatically display AdSense ads when viewed. You should be able to change other themes using a similar process.

Bill
3 comments ( 172 views )   |  0 trackbacks   |  permalink   |   ( 3.1 / 26 )
Blogging $100 a Day 
Tuesday, August 14, 2007, 04:03 AM
Posted by Administrator
Welcome to the first post of my new blog, Blogging $100 a Day!

The objective of this blog is, of course, to make some money. Not only that, but also I'm going to share some of my strategies and methods that will move me closer to my goal. Hopefully, you will be able to apply my methods and be able to make some cash of your own!

What is my goal? I'd like to make $100 per day. I think that is a lofty, but obtainable goal. I know there are several others out there who have done it, and I know with hard work and diligence I know I can do it as well.

I've tried a few other ways of making money online before starting this blog. I have made a few bucks by selling some things on EBay. I even threw an ebook on the auction site to see if I would have any takers, which I didn't. Perhaps if I was more persistant, I would have made a few bucks selling a bunch of ebooks, but it didn't seem like an easy way to make money. I may try selling ebooks in the future and will post my experiences here.

I also tried the porn business, but the biggest problem with that is the legality factor. The U.S. government has really started cracking down on adult site operators, so I don't feel good about putting my neck on the line peddling adult wares to the masses. Besides, who pays for porn on the internet, anyway? There are a gazillion free galleries out there.

So, now my focus is on the blogging scene as you can plainly see. I'm going to try my best to post here every day and see what kind of traffic I can dig up. I have signed up for AdSense and should hopefully have my AdSense account activated soon. You'll know if my account was activated if you see some ads on this blog in the future.

Tomorrow I will tell, in depth, how I got this blog started. I'll go over topics such as the software I'm using and my hosting provider.

Until next time...
Bill

7 comments ( 61 views )   |  0 trackbacks   |  permalink   |   ( 2.9 / 31 )

<<First <Back | 1 | 2 | 3 | 4 | 5 |