Skip to Content

Aarron Walter

XHTML | CSS |

My Book: Building Findable Websites

Building Findable Websites: Web Standards, SEO, and Beyond
Building Findable Websites: Web Standards, SEO, and Beyond
Aarron Walter
Buy on Amazon
Book's Companion Website
Companies waste fortunes seeking a magic bullet for Search Engine Optimization. But the keys to honest, effective web findability are appropriate writing and semantic markup. Aarron Walter’s wonderfully lucid and informative book tells everything you need to know to get your web content (or your client’s) in front of as many appreciative readers as possible.

- Jeffrey Zeldman, founder, Happy Cog Studios author, Designing With Web Standards, 2nd Edition

Now playing on my computer

Dan Benjamin – The Conversation 6: Ad Block This! (... Track | Artist
Dan Barber – TEDTalks : Dan Barber: How I fell in l... Track | Artist
Woody Herman – Lollipop Track | Artist
Amon Tobin – The Nasty Track | Artist
Giorgio Moroder – I Wanna Funk With You Tonight Track | Artist
My Playlist Feed | My Last.fm Profile

Recent Photos From Flickr

DSCN7577, Sat, 13 Feb 2010 07:32:38 -0800 DSCN7574, Sat, 13 Feb 2010 07:32:14 -0800
DSCN7573, Sat, 13 Feb 2010 07:31:50 -0800 DSCN7572, Sat, 13 Feb 2010 07:31:26 -0800
My Flickr Photo Stream | All Photos

Archive for the 'Development' Category

Findability/SEO Cheat Sheet: Quick Guide to Web Standards SEO

28 Jul . 2008

When I was researching my book, I asked a group of my students at The Art Institute of Atlanta what sorts of content they’d hope to find in a book exploring findability and SEO through web standards. Thinking like students with limited time to work on their projects, they all agreed that “the book should include coverage of what needs to be prioritized, and what can be done later if you run out of time”. Brilliant idea! I never would have thought of that. Well it’s covered in chapter 9 thanks to them.

As I was running through my table of contents with them, they pointed out that it’s all useful info, but it would be nice if there were a quick reference that you could just print out and keep nearby as you start new projects. That way you don’t miss any of the important stuff you should be doing to make your site findable.

I’ve created what I think is a pretty comprehensive findability strategy cheat sheet that will guide you through all of the stuff you should be doing when creating new websites or even redesign existing ones. All of the advice follows industry best practices and web standards, and have references to the places in my book or in the 5 free online chapters where you’ll find detailed explanation and examples of how to do this stuff.

I hope you find it useful!

download free findability strategy cheatsheet [PDF 200k]

Running Two Domains On One Shared Hosting Server

15 Jan . 2007

Most people run their web sites on one of the many inexpensive shared hosting servers running a LAMP environment. If you are like me, you probably have a number of domain names registered, perhaps all parked on the same server pointing to the same site. It would be great to split things up, though, to point one domain to a particular site on your server, and other domains to their own site. Apache lets you do this using a special .htaccess file, which configures the server software on the fly. You can set up unique sites in their own directory on your server, and then
direct Apache to point requests for a particular domain to that folder. Let’s assume the domain you want to redirect is called “somedomain.com”, and the folder on your server where the site files reside is called “somedomain”. Create a plain text file with a text editor and add the following to it:

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} somedomain.com
RewriteCond %{REQUEST_URI} !somedomain/
RewriteRule ^(.*)$ somedomain/$1 [L]

If you are on a Mac or Linux machine, you will need to save the file as something like htaccess.txt so the operating system does not hide the file (.htaccess is a special name the operating system recognizes, and will try to interpret the commands within). Upload the file to the root directory on your server (sometimes called, htdocs, public_html, or www among other names). Rename it .htaccess, then try accessing somedomain.com in a browser. It should direct your request to the files within the somedomain folder transparently, giving the effect of multiple domains with their own site running on the same shared hosting environment.

Atlanta Adobe User Group Formed

09 Jan . 2007

Michael Hagel, a former student turned friend, has recently organized an Adobe User Group that will have its first meeting to meet and greet all interested in taking part on Thursday January 11 at 7PM at Deardorff Communications. For more information visit the official site. Michael has some excellent guest speakers lined up for the first few events, and is a wealth of knowledge himself with Flash and mobile platforms.

Displaying File Icons for Downloads With PHP

14 Dec . 2006

I've worked on a few projects where a client had a series of files they wanted to offer as downloads, and the file types were all different. It's nice to show users what type of file they are downloading with an icon that represents that format. To do this, I store the file info in a table that might look something like this:

Files Table

The $_FILES super global variable gives you access to all of this useful information about your file when it is uploaded, and storing it in the table along with the file name and date posted makes looping through them to display on a file download page convenient and easy. If your file form tag was called "newFile", here's what your SQL statement might look like to store the record in your database:

PHP:
  1. $sql = "INSERT INTO filesTable SET fileTitle='".$_POST['fileTitle']."', fileName='".$_FILES['newFile']['name']."', fileSize='".$_FILES['newFile']['size']."', fileType='".$_FILES['newFile']['type']."', datePosted='".time()."' ";

With the file type stored, when you pull the records out for display, you can use the fileType field to generate an image tag with the
corresponding file type icon. I wrote a simple function to handle this for me that I keep in an external file, and simply pass it the fileType and fileName strings to get the correct image tag. Here's what that looks like:

PHP:
  1. <?
  2. function icon($file, $filename){
  3.  
  4. // Determine File Type
  5. // See list of all possible mime types at http://www.webmaster-toolkit.com/mime-types.shtml
  6. switch( $file ){
  7.  
  8. case "text/html": $file = "html.gif"; $alt = "HTML File"; break;
  9.  
  10. case "text/shtml": $file = "html.gif"; $alt = "HTML File"; break;
  11.  
  12. case "image/pjpeg": $file = "jpeg.gif"; $alt = "Progressive Jpeg Image"; break;
  13.  
  14. case "image/jpeg":$file = "jpeg.gif"; $alt = "Jpeg Image"; break;
  15.  
  16. case "image/png": $file = "png.gif"; $alt = "PNG Image"; break;
  17.  
  18. case "image/gif": $file = "gif.gif"; $alt = "GIF Image"; break;
  19.  
  20. case "image/tiff": $file = "tiff.gif"; $alt = "Tiff Image"; break;
  21.  
  22. case "application/pdf": $file = "pdf.gif"; $alt = "PDF File"; break;
  23.  
  24. case "application/word": $file = "word.gif"; $alt = "Word Document"; break;
  25.  
  26. case "application/msword": $file = "word.gif"; $alt = "Word Document"; break;
  27.  
  28. case "application/powerpoint": $file = "excel.gif"; $alt = "Excel Spreadsheet"; break;
  29.  
  30. case "application/excel": $file = "powerpoint.gif"; $alt = "Powerpoint Presentation"; break;
  31.  
  32. case "text/plain": $file = "txt.gif"; $alt = "Plain Text File"; break;
  33.  
  34. case "application/zip": $file = "zip.gif"; $alt = "Zip Archive"; break;
  35.  
  36. case "application/x-stuffit": $file = "sit.gif"; $alt = "Stuffit Archive"; break;
  37.  
  38. case "application/x-msdownload": $file = "exe.gif"; $alt = "Executable"; break;
  39.  
  40. case "application/octet-stream":
  41. // Find Out If File Is PSD
  42. if( eregi(".psd",$filename) ){
  43. $file = "psd.gif"; $alt = "Photoshop Document";
  44. }elseif( eregi(".icc",$filename) ){ // Find Out if File Is ICC
  45. $file = "icc.gif"; $alt = "ICC Profile";
  46. }else{
  47. // Use Generic Icon
  48. $fileicon = "doc.gif"; alt="Unknown File Type";
  49. }
  50. break;
  51.  
  52. default: $file = "file.gif"; $alt = "Unknown Tile Type"; break;
  53.  
  54. }
  55.  
  56. $imgTag = "<img xsrc=\"images/$file\" alt=\"$alt\" />";
  57.  
  58. return $imgTag;
  59.  
  60. }
  61. ?>

The function is really just a big switch statement looking at the fileType string. The reason I pass the fileName string as well is because certain files like PSDs, and color correction profiles (ICC), share the same MIME type. Actually there are a lot of file types that share the "application/octet-stream" MIME type, so checking the file's extension can provide a means of determining what kind of file it really is. Note, this is not a sure fire solution if the file does not have an extension or has the wrong one. If the function gets stumped, it returns a generic file icon instead. Here's how you would use it:

PHP:
  1. <?
  2. // include fileIcon function
  3. require_once('inc/fileIcon.php');
  4.  
  5. $sql = "SELECT * from filesTable ORDER BY datePosted";
  6. $result = mysql_query($sql);
  7.  
  8. <ul>';
  9. while( $row = mysql_fetch_array($result) ){
  10.     <li><a xhref="files/'.$row['fileName'].'">'.icon($row['fileType'],$row['fileName']).' '.$row['fileTitle'].'</a></li>
  11. ';
  12. }
  13. echo '</ul>
  14. ';
  15. ?>

You could easily extend the icon function to recognize many other formats just by adding new cases. To see a complete listing of MIME types visit http://www.webmaster-toolkit.com/mime-types.shtml. You can download a good starter set of file icons here: File Icons

Dynamic Select Menus With PHP

12 Dec . 2006

When building content management systems, or most any web application, you often need to generate select menus dynamically by querying a database. A Select menu offers a user a set of predefined options to choose from, and prevent possible input errors that could occur if you instead gave the user a text field to type their selection, resulting in typos or selection of an option that is not available. A perfect example is when you have some list of categories stored in a table, and you need to create a form that allows a user to add a new record in a particular category. Here's what your table may look like:

Categories Table

A unique category Id is used as the primary key, creating a practical method of referencing a category. To query this table and generate a select menu, we can use a while loop like this:

PHP:
  1. <?
  2. $sql = "SELECT * FROM categories ORDER BY CategoryTitle";
  3. $result = mysql_query($sql);
  4.  
  5. echo '<select name="category" id="category">';
  6. while( $row = mysql_fetch_array($result) ){
  7. echo '<option value="'.$row['CatID'].'">'.$row['CategoryTitle'].'</option>';
  8. }
  9. echo '</select>';
  10. ?>

Notice that the select tags need to be written before and after the loop, so you don't end up with multiple menus, but just one menu
with many options. This approach is practical for future maintenance too, as you can simply add a new category to your database, and the interface will include it automatically.

The above example works great for building a menu on an add page where the user has not yet selected an option and stored it in a database,
but if you were creating an edit page you would need to have the user's previous selection already shown in the menu.to do this you would need to dynamically write in the selected="selected" attribute/value pair in the option tag for the category selected. Assume we have an articles table that has a CatID field that relates to our category table. To find out which option was selected we'll compare the CatID in the articles table and the CatID in the categories table as we run a loop to build the menu. We'll need to run two queries, one to get the articles record (in this demo I'll hard code in the id of the article we want) and one to get the categories.

PHP:
  1. <?
  2. $sql = "SELECT * FROM articles WHERE id='5'";
  3. $article_query = mysql_query($sql);
  4. $article = mysql_fetch_array($article_query);
  5.  
  6.  
  7. $sql = "SELECT * FROM categories ORDER BY CategoryTitle";
  8. $category_query = mysql_query($sql);
  9.  
  10. echo '<select name="category" id="category">';
  11. while( $category = mysql_fetch_array($category_query) ){
  12. if( $article['CatID'] == $category['CatID'] ){ $selected = ' selected="selected"'; }
  13. echo '<option value="'.$category['CatID'].'"'.$selected.'>'.$category['CategoryTitle'].'</option>';
  14. }
  15. echo '</select>';
  16. ?>

The $selected variable stores our attribute/value pair needed to preselect the user's option stored in the database, and will be empty if the condition was not met, thus leaving the option tag untouched.

Yet another common, dynamic select menu scenario is displaying date selections for years, months, or days. I create an external arrays file that has associative arrays of common lists such as this. Here is what such a file might look like. You could also add things like credit cards your e-commerce system accepts, and a list of countries for shipping information forms. Looping through associative arrays like this is a little different.

PHP:
  1. <?
  2. require_once('arrays.php');
  3.  
  4. echo '<select name="month" id="month">';
  5. foreach($year as $key=>$value){
  6. echo '<option value="'.$key.'">'.$value.'</option>';
  7. }
  8. echo '</select>';
  9. ?>

A foreach loop is the most convenient approach for associative arrays, giving you easy access to the key and the value of each item in the array.

There are an infinite number of applications for these examples, whether you are building a contact form or an entire content management system. Hope you find them useful!