David Golding



Google Webmaster Tools, Sitemap Yummies

By David Golding

I’m grateful that Google has begun to help us out a little. First, it was analytics software handed out for free that had me feeling a little less beat-down by the big dogs. But now that they’ve improved their backend tools for webmasters, I’m thinking it may be worthwhile to go back to fighting for top positions in their index.

You see, I’ve gotten a little complacent about it all. Not that it’s not worth it… In fact, “organic” leads to your site actually drive better customers because they trust it more. It’s like reading a newspaper headline versus the advertisement on the next page. People just place more trust in the body text of the paper, despite slanted editing sometimes. It’s been rather comical to me all the “expert” advice people try to give, like they really know anything. Matt Cutts is sought after simply because he blogs from the inside of Google. Well, maybe he does know something, but he never shares very much in my book. And other gurus just spout out the same old things, year after year. It gets a little dry. There’s more to life on the internet than Google.

Alright, enough with the woe-is-me-Google-is-too-ubiquitous diatribe. Really, I started this post wanting to tell y’all that if you haven’t worked with Google’s sitemap tools, you ought to.

First, sign up with a Google account if you haven’t already. Then log in using the Sitemaps page. Next to “Add a Site” type in the URL of the desired domain name.

When you create a sitemap, it’s as simple as pasting the following XML code:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc>http://www.domain_name.com</loc>
<priority>0</priority>
</url>
</urlset>

For each link you want to be included in the site map, just repeat the <url> entry and add the absolute URL in the <loc> tags.

Once you’ve uploaded the sitemap.xml file to your server, then click “Add Sitemap” and enter the URL to the file. Google will then be able to parse through the site map file and use it for the next runs of the Googlebot indexing machine. You may want to verify your site as well. To do this, you go back to the main log in page and run through the check list. It will ask you to paste a line of code into the header tags of your home page. Then you notify Google that it’s there and it will verify it. Googlebot is now prepped to scan your site and follow the links you have provided. This doesn’t guarantee any higher rankings in the engine, but you should get included in their index faster than by simply using the Google Add URL page.

Lest you think that is the end of it, go back to the “Manage Site” links on the main login page and select your site. You’ll notice three tabs in the top left on the following screen: Diagnostic, Statistics, and Sitemap. Click on Statistics and you’ll find more details on which keywords pull up your site and what your ranking is. Finally! Some help from Google! No more paying people to pore over the rankings looking for where you turn up. Google just tells you here what’s working for you and what’s not. When you combine this with their Analytics tools, all of which are free, then you can begin to analyze the search happenings of your site over the web.

So go to! Enjoy the extra help from the Google clan!


How to Install CakePHP on a Mac

By David Golding

So you wanna join the web frameworks bandwagon, but you don’t want to have to learn Ruby? CakePHP is probably your best bet. In this tutorial, I’m going to give step by step instructions for getting this to work on a Mac. If you’re a PC user, it’ll all still probably work fine, I just haven’t tested this method in that environment yet.

Get a Localhost Set Up

If you’re new to web development, you ought to know that there are two ways of testing your software: 1, code everything and upload it, then browse to the site and test the link; or 2, set up a localhost on your machine and run it from there. Don’t even think about doing it the first way! That will take you forever. Here’s how to set up a localhost on your Mac easily.

First, go to Apache Friends. Download the installation files and run them. You’ll end up with a folder in your Applications folder called “xampp.” Next, download the following helper files: Mampp Auto Start/Stop. Place these in your folder titled “xampp” and launch the file “mamppstart.” (You can, if you want, open either of these files using the AppleScript script editor program to save your password. Then, when you launch these, xampp will automatically start without you having to type in your root password.)

Now, if you open your web browser, when you type “http://localhost” you should get a welcome screen for xampp.

In your xampp folder, there’s another folder called “htdocs.” Whatever you place in this folder is then accessible via the localhost. For example, if I create a folder called “dave” in the htdocs directory, and place an index.html file in that folder, then when I browse to “http://localhost/dave” that file will be brought into the browser.

Now that we can run PHP files on the localhost, let’s install Cake!

Installing CakePHP

Go to the CakePHP website and download the latest release of CakePHP. (On their site they have a large link to the left that you can’t miss called “Download it Now!”.) Extract either the .bz2, .tar, or .zip file to get a folder called “cake_x.x.x.xxxx” (At the time of this post, I got the folder “cake_1.1.8.3544.” You can rename the folder to anything you want, say “testdrive,” and then place it into the xampp/htdocs directory. Now when you type http://localhost/testdrive, you should get a screen like this:

To get it working right, we need to set up some databases and get those databases linked up to Cake. To do this the easy way, we need to install some helper apps.

Getting MySQL installed

Xampp comes with MySQL. If you like, you can just go to http://localhost while xampp is running, and launch PHPMyAdmin to access your databases. But, if you’re like me, using a mouse can be cumbersome, and I like a nifty little program called CocoaMySQL. Download and install this program and you’ll end up with this handy screen when you launch it:

Type in the following info to access MySQL:
Host: localhost
User: root
Password: [your password]
Socket: /Applications/xampp/xamppfiles/var/mysql/mysql.sock
Now you’re in business. Create a new database, called “testdrive” and a new table called “records.” Next we just have to link up this database with CakePHP.

Configuring MySQL with Cake

In your testdrive folder, there’s another folder called app. Open config and rename the file database.php.default to just database.php. Now, open database.php and add your information to link it to the database. (In our example, the following will link up Cake with MySQL.)
Connect: mysql_connect
Host: localhost
Login: root
Password: [password]
Database: testdrive
Prefix: [left empty].

You’ll notice that there are two arrays listed there, $default and $test. I like to just put the same in both, to make it easy on myself (in other words, use just one database for both test and default environments). Now, go back to http://localhost/testdrive and you should see a notice that says “Cake is able to connect to the database.” Cake is now fully configured and running with your database!

A Simple Program Using the Cake Framework

Now that we’ve got Cake running with xampp and MySQL, let’s get a program going. Go to the app folder and create a new file in the controllers folder called records_controller.php. We’ve called it “records” because that corresponds with the table name we created earlier. With the “_controller.php” following, Cake will be able to link up this controller file with the table in our database and run some functions for us.

In the records_controller.php file, paste the following lines:

<?
class RecordsController extends AppController {
var $name = "Records";
var $scaffold;
}
?>

This tells Cake to run a scaffold of the database. But, we still need to create a model file that will do the talking to the database and supply data. Because we’re using a scaffold, we won’t need to do anything more than identify the name of the table. Create a new file called record.php and place it in the app/models folder. Paste the following lines in this file:

<?
class Record extends AppModel {
var $name = "Record";
}
?>

Browse to http://localhost/testdrive/records and you’ll get the scaffold view of the database. Notice that there are lots of error notices that are at the top. These resulted from file permissions not being set correctly. We do that now by opening the Terminal and typing the following lines:

#: sudo su
#: cd /Applications/xampp/htdocs/testdrive/app
#: chmod -R 777 tmp

Now that the permissions are set correctly, you should see this:

Let’s say you want a simple database program that will list email addresses for you with the name of the person. On the fly, all you have to do is go into CocoaMySQL and add the necessary fields. I did the following:
name [varchar] [255]
email [varchar] [255]

Go back to http://localhost/testdrive/records and voila! Cake has already caught the changes and is working with them. You can click on New to create a new record, and all is figured out. As you can see, working within a framework can shave off a lot of time, especially for simple database calls that normally you’d have to do with mysql_query("SELECT * from ... "); strings. The scaffolding does all this for you.

I recommend using some of the walkthroughs on the Cake site. They have a good manual and wiki to help you through it all. And if you’re having tons of problems, go ahead and drop me a line.


Browse Happy

By David Golding

I am pleased to mention something I think is long overdue. Anyone who has browsed this site in Internet Explorer knows that I advise all my customers to avoid IE for security reasons. Well, some others out there have put a site together designed to help you make the switch from IE to something better that fits your internet browsing experience.

I love the idea of Browse Happy. They have endorsements by professionals who have made the switch and give great encouragement to move away from IE. They even have installation instructions for the browser of your choice. A fabulous idea, indeed. Please, I hope everyone out there will abandon Internet Explorer: it’s terrible, it’s useless, and it’s been forever since they’ve updated it. Coding sites for it is a nightmare, and because of Microsoft’s utter ineptitude when gauging customer preferences, it’s not going to get any better with IE7 (I’ve played with the beta, and have been shocked that for such a large programming company, they can’t even come close to the open source community on this one).

So, please, make the switch. Find what you love. Just don’t blame me when you find a billion viruses from sticking with Internet Explorer.


« Older Entries

Beginning CakePHP: From Novice to Professional by David Golding

David Golding

A blog about CakePHP, web design, and grad studies in religion. © 2008, D. Golding