Thursday, September 10, 2009

Code is Poetry?

The tag line for Word Press is "Code is Poetry." If, at its heart, poetry consists of words that affect people's thinking and feelings, then code could be poetry. But code is a strict disciplinarian compared to poetry, certainly contemporary poetry. A single quotation mark out of place or an extra comma will break everything creating a "Page Not Found, Error 404." Even English teachers grading on a curve don't do that.

Not being content using the available Word Press themes, I decided to create my own header, color scheme and custom pages. I dove into the languages to create my own hacks. Some improvements for my latest website upgrade include:

  • New look including a header photo I took of the Emperor's globe in the Forbidden City, Beijing with complementary colors.

  • Created destinations template page which use the page name (destination) as a category definition and lists posts chronologically. Sidebar shows relevant post titles and photos.

  • Fixed search function and drop-down menu.

  • Added footer with dynamic navigation links and alternate footer.

  • Added next/previous post links in single page view.

  • Generally made content easier to find.

  • Created context sensitive sidebars.


WordPress is dynamic, meaning that pages are created on the fly; actual content is stored in a database and the code pulls the content, appearance and structure together to serve a fresh page upon a users' request. Word Press is open source, meaning a community of users and volunteers continues to improve it and extend its capabilities. Word Press uses three open source languages, namely PHP, mySQL and HTML/CSS/XML.

To tinker with Word Press requires setting up a testing server . You can tinker directly with a live site, but when something goes wrong, the site is down. Because the pages are dynamic, you can't just change a static HTML page and effect changes. A testing server is a local PC that mimics the software used on the web server. I use XAMPP installed on Windows XP. I experimented setting up Linux on a separate box, but never got the server configured properly. XAMPP provides Apache, mySQL and PHP;  I installed Word Press on top of that.

Then I created a SQL dump from my live database using myPHPAdmin, downloaded it, used a text editor to change links from website to local host and "uploaded" it to my testing server. I discovered I had a database collation issue, a mixture of Swedish and Unicode tables. I fixed that, confirmed it worked, changed the links back and uploaded the amended version back to the live server. Now I had a running test server and live server with the same content and software. I could tinker with my test site to my heart's content without affecting my live site. After I was done, I changed all the links back and uploaded my new theme, the images and database. As a basis for modifications, I used Brian Gardner's Shades of Blue theme, tantan nooodles Flickr plug-in and (of course), the default Kubrick theme .

Regarding Code as Poetry, it is fascinating to me that you can change one line of code and powerfully make changes to hundreds of web pages.

No comments:

Post a Comment