Tony Thomas

Father to two, husband to one, web developer and musician.


Archive for March, 2011


Simple RSS Parsing and Caching Using PHP

Saturday, March 12th, 2011

I feel like I should begin by stating that my college degree is in English Literature. In other words, I am not formally trained to be a programmer. Still I’ve spent many years working in PHP. It can be liberating to find out that something you thought would be complicated, is actually not that hard when broken down into discrete steps.

This whole adventure started for me when I went looking for a way to parse an RSS feed. Contrary to those who proclaim that RSS is dead, at it’s heart, RSS is XML. As such it’s a useful method to access content. In my case, I wanted to parse my blog RSS feed as well as my most recent Tweets. That was revelation number one.

RSS is XML > XML has a structure that can be put into objects in PHP

To many of my friends and colleagues, this may seem incredibly simple. To me it was a revelation that opened up a new door. I’ve never tried to create an RSS parser before. Suddenly it was less daunting. (Aside: For me, simple truths often come as revelations. To know me is to know this.)
(more…)

When to Use CSS content Property

Saturday, March 5th, 2011

CSS offers a tempting attribute in the content property. The syntax is as follows:

content: 'Add this.';

The code above will append “Add this.” to the element, id or class of our CSS declaration. The problem with this is that we’re putting content into our presentation code. Also, this content is not accessible by screen readers or search engine crawlers. A good rule of thumb is to use this property as a means of progressive enhancement. Generally speaking, I like to use it for presentation that enhances the site, but contributes nothing semantically.

Here’s an example:

Let’s say we want to use this icon to denote links that are external to our site:
external link icon

Use the content property:

a.external:after {
    content: url(path/to/external.png);
}

The image itself provides no semantic value to the document. It’s merely an enhancement and would be ignored by screen readers anyway. We can safely useĀ content in this case. Another good use is this tutorial for creating CSS-only arrows.