Friday, August 17, 2007, 06:40 PM Posted by Administrator
 Free Hosting Providers come in may shapes and sizes. Some hosting providers will place advertisements on your page in exchange for letting you use space on their servers. The site owner is basically being used by the hosting provider as a way to force viewers to see the advertisements that provide the host's income. Not that there is a problem with that exchange, but for the purposes of generating your own revenue, you don't want other advertisements competing with your own! I would personally recommend, for your own advertising revenue's sake, staying away from free hosts that include their own ads on your pages. This, unfortunately, limits the choice of a good free hosting provider. After all, these free hosts have to generate their revenue somehow, and hosting their own ads is probably the easiest way to do so. Other free providers may use other methods besides hosting advertisements to make money. The free host 110mb.com, where this site is currently located, seems to use a variety of non-intrusive methods to earn revenue. One is using the free service as an advertisement of their non-free hosting services. They seem to be very reliable and pages load up very quickly, so in the future when I move to a non-free host, I will look into their non-free services. Files are limited to less than 5 MB in size on their free hosting package, as to provide an incentive to upgrade to get rid of file size limits. They also provide some extras that you can use if you pay a small fee. For instance, to use MySQL on your free site, you need to pay a small one-time fee to turn it on forever. So, I personally recommend 110mb.com (and, no, I'm not on their payroll in any way). Make sure you look around a bit and see which hosting provider is right for you. Bill
Friday, August 17, 2007, 06:11 PM Posted by Administrator
 If you are using a modern browser, you should notice the icon of the site has changed to a dollar sign. The icon can be found up in the address bar of your browser. This is a straightforward change that require no code change to work with Simple PHP Blog. I found a nice free image that fit my topic, and then edited it with my favorite image editing tool, The Gimp. After editing the image to my heart's content, I then resized the image to 32x32 in size, and then saved it as a Windows .ico file. After that was complete, I then saved it on the website as /interface/favicon.ico, overwriting the file that was already there. In order to actually see the icon after uploading the file, I needed to clean up all of my cached data in my web browser. Once that was done, I restarted my browser, and headed to the blog. At that point, I could see that the new icon was now in place. If you still cannot see the dollar sign icon, you probably need to do what I did, empty your browser's cache, and then reload your browser, and the page. Bill
Thursday, August 16, 2007, 09:40 PM Posted by Administrator
 Adding Google Search to my page was a relatively painless process. The worst part is adding the necessary quotes and line feeds to the code that Google provides you. To add Google Search to the already existing Search box, I had to once again modify the Simple PHP Blog file, scripts/sb_theme.php. Once in the file, I needed to locate the menu_search_field function, which is the piece of PHP code that results in the Search box being displayed on the Blogging $100 a Day page. After the line: $str .= '</form>';I had to insert the following code: $str .= '<hr>'; $str .= '<!-- Search Google -->' . "\n"; $str .= ' <center>' . "\n"; $str .= ' <form method="get" action="http://www.google.com/custom" target="google_window">' . "\n"; $str .= ' <table bgcolor="#' . $user_colors[ menu_bg ] . '">' . "\n"; $str .= ' <tr><td nowrap="nowrap" valign="top" align="left" height="32">' . "\n"; $str .= ' <a href="http://www.google.com/">' . "\n"; $str .= ' <img src="http://www.google.com/logos/Logo_25gry.gif" border="0" alt="Google" align="middle"></img></a>' . "\n"; $str .= ' <br/>' . "\n"; $str .= ' <label for="sbi" style="display: none">Enter your search terms</label>' . "\n"; $str .= ' <input type="text" name="q" size="11" maxlength="255" value="" id="sbi"></input>' . "\n"; $str .= ' <label for="sbb" style="display: none">Submit search form</label>' . "\n"; $str .= ' <input type="submit" name="sa" value="Search" id="sbb"></input>' . "\n"; $str .= ' <input type="hidden" name="client" value="pub-xxxxxxxxxxxxxxxx"></input>' . "\n"; $str .= ' <input type="hidden" name="forid" value="1"></input>' . "\n"; $str .= ' <input type="hidden" name="ie" value="ISO-8859-1"></input>' . "\n"; $str .= ' <input type="hidden" name="oe" value="ISO-8859-1"></input>' . "\n"; $str .= ' <input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:375;FORID:1"></input>' . "\n"; $str .= ' <input type="hidden" name="hl" value="en"></input>' . "\n"; $str .= ' </td></tr></table>' . "\n"; $str .= ' </form>' . "\n"; $str .= ' </center>' . "\n"; $str .= '<!-- Search Google -->' . "\n";
That did the trick. Don't forget to use your own pub number!
Moving the Sidebar Menu to the Left Side
Wednesday, August 15, 2007, 03:36 PM Posted by Administrator
 Did you know that users are more likely to click on advertisements on the left side of the page? Our brains are used to reading from left to right, so we naturally look towards the left side of a page without thinking. So, my objective today was to move the Sidebar menu from the right side of the page to the left side. Conveniently, in the themes/modern/themes.php file, there is a line: $theme_vars[ 'menu_align' ] = 'left'; // Valid values are 'left' or 'right'It looks like it should be a simple affair to move the menu, right? All I have to do is change the 'left' to a 'right' and I'll be in business. So, that's exactly what I do. I modify the variable, refresh the page, and... nothing. I check out the Simple PHP Blog forums and in all the threads and posts I see, it appears my method should be correct even though it is not working. What's the problem? It turns out that the newest version of the Simple PHP Blog software that I am using, 0.5.0.1, doesn't appear to have the code to easily handle a right/left switch (at least for the modern theme). I had to add a bit of code to get it to work. In the themes/modern/themes.php file, I replaced the following code: // Begin Page Layout HTML ?> <body> <div id="page"> <div id="header"><img src="<?php echo( $img_path ); ?>header750x100.jpg" alt="" border="0" /></div> <?php if ( $blog_config['blog_enable_title'] ) { echo('<div id="title">' . $blog_config[ 'blog_title' ] . '</div>'); } ?> <div id="innerpage"> <div id="content"> <?php page_content(); ?> </div> <div id="sidebar"> <?php theme_menu(); ?> </div> </div> <div id="footer"> <?php echo($blog_config[ 'blog_footer' ]); ?> - <?php echo( page_generated_in() ); ?> </div> </div> </body> <?php // End Page Layout HTML } with the following code: // Begin Page Layout HTML ?> <body> <div id="page"> <div id="header"><img src="<?php echo( $img_path ); ?>header750x100.jpg" alt="" border="0" /></div> <?php if ( $blog_config['blog_enable_title'] ) { echo('<div id="title">' . $blog_config[ 'blog_title' ] . '</div>'); } ?> <div id="innerpage">
<?php if ( $theme_vars[ 'menu_align' ] == 'right' ) { ?> <div id="content"> <td width="<?php echo( $theme_vars[ 'content_width' ] ); ?>" > <?php page_content(); ?> </td> </div> <div id="sidebar"> <td width="<?php echo( $theme_vars[ 'menu_width' ] ); ?>" > <?php theme_menu(); ?> </td> </div> <?php } ?>
<?php if ( $theme_vars[ 'menu_align' ] == 'left' ) { ?> <div id="sidebar"> <td width="<?php echo( $theme_vars[ 'menu_width' ] ); ?>" > <?php theme_menu(); ?> </td> </div> <div id="content"> <td width="<?php echo( $theme_vars[ 'content_width' ] ); ?>" > <?php page_content(); ?> </td> </div> <?php } ?>
</div> <div id="footer"> <?php echo($blog_config[ 'blog_footer' ]); ?> - <?php echo( page_generated_in() ); ?> </div> </div> </body> <?php // End Page Layout HTML } and now the Sidebar menu moves to the left! Now I can switch the location of the menu with ease, by modifying the $theme_vars[ 'menu_align' ] variable.
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
<<First <Back | 1 | 2 | 3 | 4 | 5 | Next> Last>> |