Posts Tagged ‘webdevelopment’

Coding email templates

Saturday, November 22nd, 2008

I’ve written a couple email engines in my day – one in PHP and one in ASP – to integrate and automate businesses with email marketing.  Work to be proud of, indeed. Invariably after the engine part is done – or maybe you’re using an established service* for the engine part – there needs to be some content, some email design.

*Examples of consumer email marketing services (“engines”) using email templates and data merging:

Templates are for branding

HTML templates need to be made so the emails that are received are branded – at least with a logo and company colors.  This is not possible with a plain text email of course.

Merging process

The engine will take the templates and merge in some variables like “first name”, “email to”, “email from”, etc – a basic find-and-replace loop.  The HTML template will contain placeholders for each variable – strings like “{#EMAIL_TO#}” – and the loop will replace those with values from the database, then send the post-merged email to that person in the mailing list.

Email formats

There are many ways an email can be formatted such as “quoted-printable”, “text/plain”, and embedded images, but my focus is on “text/html” with linked images.  Here is a handy site that can convert static HTML into quoted-printable format, and back.

Images

The images will be stored on a server and referenced like any other web page would reference images.

Privacy and missing images

Some email viewers like Gmail tend to hide images that link back to a server, and the user has to click a “display images” link to see the email as it was intended.  This is a privacy feature because images that link back to the server provide the sender with a method for tracking who opens the email.  The log can be parsed to see who requested the image when the email was viewed.

We need to make the design look good even if all the images are missing.

alt attribute

For this reason, be sure to fill your image tags with good descriptive “alt” values so those users still know what they’re not seeing.  Putting “please display images”  in the “alt” attribute is a consideration, but might also be a flag to the program that the message is spam.

Tables

Today web designers use style sheets instead of tables for positioning content.  CSS-heavy, un-tabled code may be a good idea for modern web sites, but not for HTML email templates.  Email templates rely primarily on tables for positioning content, making columns, aligning text, etc.  This is simply because the email could be viewed in any number of applications, with a high likelihood of poor CSS support, even in modern email clients such as Outlook 2007 (whose rendering engine is Word, of all things).  Tables are “old school” web design, and so are email templates.  Being a CSS guy, I just have to suck up that reality.

Put CSS in style attribute

This isn’t to say that one should abandon CSS in email templating altogether.  In fact, feel free to use the “style” attribute – just back it up with the non-CSS way too, as insurance.

If the cell needs a background, use “style=background:url(some image path)” in addition to “background=(some image path)”.  If the font needs a color, use “style=color:red” in addition to “<font color=#ff0000>”.

Go attribute-crazy

The more attributes each table cell has, the better.  Don’t forget attributes such as “height”, “width”, “background”, “bgcolor”, “align”, “valign” and even CSS’s “style”.  You’ll thank yourself when testing in even the latest browsers and email clients.

Always use the “align” attribute in cells with text.  I can’t tell you the numbers of times I’ve seen Internet Explorer “center” text that “left-aligns” in Firefox. Setting “<td align=left..” fixes this.

Stay aware of the design affects of merging in variable data that could reflow text and images.  When columns are growing and shrinking with variable content, and you want the content to “top-align,” use “<td valign=top..”.  Otherwise there tends to be rarely-desirable vertical centering.

Variable images

If your variable images are variable sizes, heaven help you.  If necessary resample all the variable images – perhaps with ImageMagick – to give them the same widths or heights – whichever dimension flows best in your design.  Whatever table cell is containing your image should still have the height and width set.

spacer.gif

A spacer.gif is a 1×1 transparent GIF that can be resized to enforce the size of an empty table cell.

Remember those?  You’ll wanna pull those out from the back of the toolbox to help pad your tables.  Tables + spacer.gif is the “old way” but it’s the “right way” when it comes to making email templates.

If I have an email with 2 columns and padding in between, I will use a 3 column table with all cells’ widths, aligns, valigns set, and put a spacer.gif in the center “padding cell” that is the same width as the padding should be.  The height of the spacer.gif can remain 1px.

Spanning

If you find yourself using “colspan” or “rowspan”, don’t.  Instead, nest tables.  It’s sounds like such a naughty thing to say, but that’s the most dependable way to go.  Go nested-table crazy! We can’t give the cell dimensions any leeway.  Spanning cells tends to produce more random cell dimensions than the predictibility of nested tables.

Table setup example

Here’s a good set up for a centered, 650px-wide table.

<table cellspacing=”0″ cellpadding=”0″ border=”0″ align=”center” width=”650″>

“cellspacing”, “cellpadding” and “border” need to be set. Assume nothing about any dimension.  Be explicit everywhere.

Testing

Don’t forget to test in multiple browsers, and multiple email clients. This is where we see how necessary all the excessive table markup was.

Here’s a few email clients to consider:

  • Outlook 2007
  • Older Outlooks
  • Gmail
  • Yahoo Mail
  • Apple Mail
  • Hotmail

Just because the email client is web-based doesn’t mean it is just as CSS-compatible as a you’d expect.  Sometimes the CSS is rewritten to prevent style conflicts with the web page it is presented in.  We would hope that the rewriting will not be harmful to your CSS, but I wouldn’t bet on it.  Best to take the hybrid route so we won’t have to worry about it.

Conclusion

Email template design is an aging art with the advent of Web 2.0 social marketing tools, but it still reaches the most people wherever they may be online.  Deploying age old web design techniques is still the best way to code an email template so that it looks the same in most people’s email clients.

The FriendFeed API

Thursday, May 29th, 2008

First off, let’s define aggregation as taking a bunch of things and putting them all in one place.

Let’s try something.  I’m going to read off a bunch of web services.  Which ones are you a member of?

  • Digg
  • Google Reader
  • Google Talk
  • Gmail
  • Mixx
  • Reddit
  • del.icio.us
  • Furl
  • Ma.gnolia
  • StumbleUpon
  • Jaiku
  • Pownce
  • Twitter
  • Seesmic
  • Vimeo
  • YouTube
  • Flickr
  • Picasa
  • SmugMug
  • Zooomr
  • Tumblr
  • iLike
  • Last.fm
  • Pandora
  • Goodreads
  • LibraryThing
  • Amazon
  • Disqus
  • LinkedIn
  • Netflix Queue
  • Netvibes
  • SlideShare
  • Upcoming
  • Yelp
  • or any blog
  • or anything else putting off an RSS feed

Each of these can be pulled into one feed by FriendFeed.com .

How many of those services are you a member of?  What do you do when you want visitors to see all your posts in one place?  Think about using FriendFeed and harnessing it’s API .  We’ll use it to create a single central feed out of the chaos.

So how does FriendFeed work?  Each member loads up their various accounts from around the web – Google Reader shared articles, Twitter posts, blog entries, YouTube videos, Flickr photos, del.icio.us bookmarks, all that stuff I listed earlier – and members can have discussions around each entry.  It’s a furious stream of information and comments coming from all directions. blogs, news, pictures, etc – all flying by, with comments.  It’s the daily web posting activity of thousands of people in one place.

Facebook already has a nice FriendFeed app so your friends can see your FriendFeed-aggregated posts.

Otherwise showing it on another web page (like a very cool business’ web page) means we’re off to the FriendFeed API.

First thing we need is a FriendFeed account.  They’re free.  Go to friendfeed.com and follow the instructions.

Then load all of your web memberships into FriendFeed so you’ll have stuff in your feed.

Then we need to download the API from http://code.google.com/p/friendfeed-api/ .  Documentation and forums are available at http://friendfeed.com/api/ .

Then, in order to authenticate with the API, we get our new account’s Remote Key from http://friendfeed.com/remotekey .

That’s all the official FriendFeed stuff we need.  Now on to our application.  I called it FriendFeedFormatter.

It is not affiliated with FriendFeed.  Use it all at your own risk. FriendFeed has stated that the API is young and could change at any time.  That disclaimer out of the way…

My code does all the work of taking our nickname and remote key and producing an HTML snippet from our FriendFeed feed that we can then have included in a PHP page.  Download example.zip from the show notes.  It’s got all the code that I’ve written using the API.

http://www.davidvanvickle.com/friendfeed/example.zip

In the show notes is a link to see sample output.  That will give you an idea of what to expect, and you can begin to think of how to embellish it.

http://www.davidvanvickle.com/friendfeed/build.php

There are only two files in example.zip.  One is my FriendFeedFormatter PHP class.  The other is build.php, which is the file you’ll customize and run.

Now find the FriendFeed API you downloaded.  In order for my custom class to work, you’ll need to include the friendfeed.php file from the API in the same folder.

So when you’re done there will be 3 files uploaded to a folder on your PHP enabled web server.  friendfeed.php from the API, plus FriendFeedFormatter.php and build.php.

Before we try to run anything we need to change a couple things inside of build.php.  So open that file in a text editor.

Enter your FriendFeed nickname where it says “MY_NICKNAME”.  Then enter your remote key where it says “MY_REMOTEKEY”.  That’s it.  There are more things we could toggle but let’s start here.

So save and close build.php and upload the 3 files to the web server.  Now you should be able to hit your build.php with a web browser and see what happens.

If all is well then you’ll see the HTML table that the FriendFeedFormatter produced using the API.  Now look in the webserver folder where you uploaded the 3 files.  You should now see a 4th file.  That file is what you’ll be including in your normal web pages.  It is JUST the HTML table displaying your feed.  Just a little piece of a web page, not the whole thing.  Perfect for inserting into a page that already exists.

Why don’t I just write a Javascript snippet like everyone else?  Well because I don’t want to slow my web pages with a call to a remote site.  The FriendFeed servers are pretty fast, but I still don’t want that dependancy if I can help it.  As long as I can run that build.php file on a regular basis, I will have a new enough include file for my site.  And it will load right away.

So how do I run build.php on a regular basis?  Good question.  If you want to automate that, I have half an answer.  If you’re familiar with running cron jobs, or if you want to learn how, cron would be a good way.  Cron allows your server to perform a task – such as calling build.php – according to a schedule, like every few minutes, instead of waiting for a web user to come along and trigger it.  Cron is usually running already.  You don’t have to install it.  Just add a crontab to call lynx, wget, or on older servers, the php cgi executable and pass it build.php and how often it should run.

Truth be told, I don’t have much experience with cron, but it seems to be where people go for scheduling scripts.  I included some examples in the show notes that I scraped from the web to get you started.  I’m sorry that I don’t have more tested examples.

Run every Monday morning at 4:41AM.  (minute hour day month weekday command)

41 04 * * 1 /path/to/lynx http://www.mydomain.com/path/to/your/cron.php
or
41 04 * * 1 /path/to/wget http://www.mydomain.com/path/to/your/cron.php
or
41 04 * * 1 /path/to/php /path/to/your/cron.php

Samples from:
http://www.hackernotcracker.com/2007-04/run-php-scripts-with-crond-and-crontab.html
http://www.modwest.com/help/kb.phtml?cat=2&qid=105

More at
http://www.webmasterworld.com/forum40/1258.htm

Otherwise just keep build.php bookmarked and hit it every time you do something that updates your feed.

Fortunately for server performance, but unfortunate for us, is that FriendFeed is on it’s own schedule.  Just because I update my blog, doesn’t mean FriendFeed is immediately aware of that post.  It may take a few minutes for it to show up in the FriendFeed feed.  (That’s a great reason to figure out how to make the cron way work)

The code to pull in the include file in your PHP page is the same code in build.php that displays the output in the browser.  The FriendFeedFormatter->get_output() method.

Once you see the output, I’m sure you’ll want to customize it more.  Go for it.

I built in a few enhancements.

One enhancement is date formatting.  The date may come to you a couple different ways.  One is in ISO8601 format.  That looks like this. “2008-05-21T15:02:22Z”

Another format would be as a UNIX timestamp, or a long number that represents the number of seconds since January 1, 1970.

You should be able to look in the date column, see which kind of date you have, and change the value of the date format variable in build.php.

$ff_date_format = ‘ ISO8601’; // or ‘unix’

On one server I got one format, on another I got the other format.  I think that’s based on the PHP version I had running but I’m not sure.  Anyway, that’s why my code has two ways to format dates.Another customization is the title of the table.  I recommend making that a link to your Friendfeed page.  The current set up has a link to your FF page, plus a link to  subscribe to your feed.

The formatter has a couple features users may appreciate.  One is inline Youtube videos.  First the user sees a JPG image of the video, but when it is clicked, it turns into a playable video.

Another feature is link detection, which is programmed to happen with Twitter entries.  The static URL’s become clickable.

The last feature is, when Flickr is detected, it lists the thumbnails of the images.

These are things I expected to happen from the API, but they weren’t there, so I added them to my formatter.

Open the formatter and notice how I can treat each service’s entries differently.  I can detect Twitter, for instance, and scan the entry for URL’s to convert into links.  Or I can detect Youtube and make the inline play feature happen.

The important thing is just to hack away to get going using FriendFeed to aggregate your public web activity.

PHP Programming with the FriendFeed API

Monday, May 26th, 2008

Problem
I want to display all of my published web activity (from podcast, YouTube, De.licio.us, blog, etc) in one place.

Solution
Use FriendFeed to pull in services, then use FriendField API to build a FriendFeed feed formatter which will build an HTML snippet file to be included on web pages. The snippet will display time-stamped activity from various web services. Display is customized by service. I created a PHP class named FriendFeedFormatter. It takes my FriendFeed nickname and remote key, and outputs the file to be included on web pages.

My FriendFeedFormatter PHP code:

Sample output | Download code ( updated May 28, 2008 )

Me on FriendFeed

My podcast episode explaining how to install and use this.

Twitter

Saturday, May 10th, 2008

Have you ever wanted to say something on the web, but it wasn’t long enough to blog so you held back? If that happens a lot, you may want to check out Twitter.

www.twitter.com

“Twitter late night is kind of a swinging place, full of insomniacs, the caffeinated, and Australians. I dig it.” – Leo Laporte

I’ve tried integrating it with Firefox using Twitbin but later just switched to the Flock browser to enjoy it’s built in Twitter support, and I have a mobile version open on my phone.

getfirefox.com

flock.com

But what is Twitter? It’s a website where you go to answer the question “What are you doing?” in 140 characters or less.

Twitter allows you to “follow” people and get “followers”.

twitdir.com show the top 100 most followed people.

twitdir.com

Friends and followers are different. Friends have to be invited. Followers just show up. Fortunately there is a privacy feature that allows you to expose your tweets only to those you give permission to, which basically turns followers into friends.

So far I only have one real world friend that uses it. And the people who follow me, I also follow.

You learn what people are into or just checking out. Some posts are entertaining. Some people are fun to listen to. Other posts serve as recommendations. You find that some people are into certain foods or restaurants. Makes you wonder if you may like that as well. It’s a great way to get out of a rut. It encourages you to try new things.

Some of the common things often shared are links to cool web sites.

Have you ever sent a long URL in an email, and it broke, and the person who received it clicked it and only half the URL went to the browser. Then they reply to you and say “hey that link you sent doesn’t go anywhere”. If you have that problem you may want to check out tinyurl.com and snipurl.com. It’s very easy to go to those sites. You don’t need a login. Enter your long URL in the text field and it will give you a very short URL that you can copy and paste into your message.

tinyurl.com
snipurl.com

Besides following people I already know, I also found a bunch of people to follow by searching by city name. I was interested in seeing what the locals were into. It’s fun reading a stranger’s tweets as they talk about places you know about. After I did that I realized others were finding me the same way.

By the end of my recent vacation, where I only had my cell phone to connect to the internet, I was convinced that mobile web apps are something I need to take more seriously, and figure out how to develop them. Probably not much to it in the case of the iPhone, as it supports any web page already. You could probably just make a tiny version of the big version and redirect iphone browsers to it. I’m sure there’s a future podcast coming on that topic.

For Twitter I found a few iphone targeted web apps. One is called “JustUpdate”. It doesn’t show other people’s entries but it’s great at doing exactly what it’s called – just updating. It would remember my login for days and was great at quickly posting updates from anywhere. There is a link to that site in the show notes. You can also find it at apple.com/webapps.

http://m.ac.nz/justupdate/about.html
apple.com/webapps

The other handy mobile twitter web app was PocketTweets. This one is nice looking and somewhat full-featured. In addition to sending updates, I used it to view and reply to friends. It also has a star for favoriting entries. Check it out at pockettweets.com. It is also at apple.com/webapps.

pockettweets.com

Then there’s Hahlo 3. It’s ranked highly and recently updated. It seems to be the winner in terms of features. You can update, view friends updates, see your profile, and even customize it with from a Settings menu. It also has a feature that allows you to search all tweets, thanks to summize.com. Check it out at hahlo.com.

summize.com

hahlo.com

The last one I’ll mention is twitterforiphone.com. It was ranked high and looks nice. Unfortunately it was too slow for my taste when I tried it, so I’ll probably be sticking with the others. May not be their fault. Twitter seems to be working out some performance issues as they scale up.

twitterforiphone.com

Even without those web apps the full size Twitter site is pretty lightweight.

Guess enough people are running around with web enabled cell phones that these services find the mobile web investment worthwhile. I’ve heard that some people text on the their phones more than they email. That is a trend worth noting.

Twitter is growing in popularity. Part of the growth is because of the hype it’s gotten on the Podcasts. Hosts are addicted to talking about it. They try not to talk about it, but can’t help themselves. I’m thinking specifically about Leo Laporte’s TWIT podcast, which drove Twitter into my head week after week.

It also probably grew because of the political race. The candidates are using Twitter to publicize their events to the web community.

What a publicity platform. That is, if you can get enough followers. I follow internet celebrities. They tweet throughout the day and have thousands of followers. At last count I have 13, to put this into perspective. For me it’s just fun. For them there is a business crossover. With thousands of followers, it’s value to a business is obvious. If you have that many people listening to you, every link you post will get hundreds of hits instantly.

A podcast could announce it’s new episodes, a politician could publish his public agenda, or a news person could provide up to the second coverage of an event.

According to compete.com, in April, Twitter had over a million users and had grown 30% that month.

http://siteanalytics.compete.com/twitter.com/?metric=uv

Twitter isn’t just a US thing. Twitter’s own blog says that in February, only 40% of their traffic was from the US. The next largest groups are Japan, Spain and the UK.

http://blog.twitter.com/search/label/stats

Maybe you want to integrate Twitter into your web site or develop a web app using their API. Just click the “API” link at the bottom of the homepage and off you go. There is also a link to the documentation in the show notes.

http://groups.google.com/group/twitter-development-talk/web/api-documentation

The API gives you access to lots of neat stuff including methods to access statuses, direct messages, friendship, favorites, notifications, and blocking.

If you have Curl installed there are examples of how to use it to play around with the API. Responses can be formatted in a few specified ways including XML, RSS, Atom and JSON. The show notes have a JSON example for getting friend updates.

curl -u email:password http://twitter.com/statuses/friends_timeline.json

Just open a command prompt and type “curl -u” followed by your account email “:” password followed by the twitter “friends_timeline” URL with the extension of the format you want. In the case of my example, the URL ends in “.json” because I want a JSON response. If you’ve ever touched a command line, or even if you haven’t, it’s pretty simple.

So in conclusion, Twitter is a fun distraction that gives you insight into other’s people’s minute by minute thoughts. Thoughts that in an of themselves are not much to write about, or even blog about, but you can be happy twittering about.

Making RSS Feeds

Wednesday, April 16th, 2008

You’ve heard the saying, “It’s better to give than to receive”. If that’s true we’re doing great today. We’re going to be on the giving end of RSS feeds. Being on the receiving end is easy, just fire up your feed reader/aggregator like google.com/reader and go down the list of new stories. Giving can be easy to, but sometimes it means getting into the code to produce exactly what you want.

Maybe you’re wondering what a feed is. Well they’re all over the internet. It is how the internet syndicates it’s content. Feeds are flying out of blogs, news web sites, and any other tuned in site with frequent content updates.

It’s basically just an xml file on a web server, like a web page or an image is a file on a web server. People use a dedicated tool to view the file contents. For a web site, you use a web browser, for a feed, you use a feed reader. I prefer the free web based reader at google.com/reader. Some email programs and web browsers are capable of being readers as well. As usual, if a tool is dedicated to a task, it is a better experience, that’s why I use a dedicated feed reader.

The Internet has lost a lot of it’s “geeks-only” feel since the web is full of stuff everyone can use. Web feeds still feel geek-ish, but that doesn’t make them any less useful. Reading feeds is like reading email. A message with a time stamp comes in and you read it. An email is addressed to a specific person or group, while a feed is open to the world. Just subscribe. Your feed reader becomes the starting point for all your internet news and updates.

So let’s go deeper. What’s in a feed technically? It’s just a text file with readable content organized using markup called XML, like a web page uses HTML. It’s editable with any basic text editor. Notepad, Textedit, everyone’s got an editor. Word to the wise – don’t use Word. Word wants to add it’s own formatting. You don’t want to change the formatting.

Editing XML means getting familiar with tags so you can give the content meaning. What’s a title? What’s a link? Tags distinguish these things. There are specific tags for feeds. There are different sets of these tags depending on which feed format you’re using. The one I always see is RSS 2, but there is also Atom, RSS 1 and RDF. An RSS 2 file uses the tags rss, channel, item, title, link, description, pubdate, and guid.

Everything is wrapped in an rss tag. In that is the channel tag and a bunch of item tags. The channel describes the feed. The feed has a title and copy, for example, which would go into the title and description tags respectively. Other tags describe the feed’s publication date and URL that would point to the feed’s associated web page.

The feed is hopefully full of stories and site updates. Each of these gets its own item tag. Some of the tags in the item tag are the same as the ones in the channel tag. title, link, description, pubdate. For every new blog entry or news story a new item tag is made. The title goes in the title tag, the body copy goes in the description tag, the web site link goes in the link tag, the date the item should appear in readers goes in the pubDate tag, etc.

Hey, you know this podcast? You may have received it because you’re subscribed to its feed using your podcast feed reader, iTunes. Well this podcast feed has got some extra tags in the channel and in each item. Apple Inc has declared it’s own feed namespace. These are tags starting with the word itunes followed by a colon followed by a descriptive word like owner, name, email, image, category, author, subtitle, summary, duration, or keywords. Some of these are a little redundant to the main feed tags, but they’re used by iTunes to get the info it needs from a feed.

<itunes:image href="http://www.davidvanvickle.com/images/seriesface2_300.png"/>

Podcasts may not have survived if it wasn’t for Apple . Podcasts certainly wouldn’t be on their way to thriving as they are now. Apple is making the complex simple. So buy an iPod, connect it to iTunes, get podcasts for free. Feeds are knitting all that together. So we’ll do what Apple says and include these tags in our podcast feed along with the others.

Anyway, we actually have one more tag to look at. It is the enclosure tag, which determines where the audio file will come from. Audio media type and file size are attributes of this tag.

So let’s say we’ve just Notepadded the heck out of an RSS 2 XML file using all these tags. What are the chances something isn’t right? The chances are high. So let’s upload the file to a web site, then wander over to a feed validator to debug it. feedvalidator.org is an awesome free service for debugging feeds. Go there, type the URL of your feed, and it will tell you how to fix any issues. Doing this beats the possibility of upsetting your feed reader and not having your content syndicated. Better to broadcast something that works.

feedvalidator.org even tells you if the http headers are wrong. If they are, modify your server to serve files with that extension as “Content-Type=text/xml”. Similarly, since you’re declaring the served content as xml, the first line of that xml file should be the first line of every good xml file.

<?xml version="1.0" encoding="iso-8859-1"?>

Okay eventually we survive validation. We just manually edited a feed.

Sometimes we can edit the feed directly like this, sometime we can’t. Sometimes someone else is producing the feed. If you have a blog, you already have a feed. Just keep on bloggin, and that will automatically update your feed.

Let’s go back to situations where we make it ourself. What are other methods besides Notepad? Do we want automated generation or manual generation? For automated, we could use a server side scripting language to crank through a database and produce our XML. For manual generation, we could get an off the shelf desktop application that outputs feeds. At least we’d get away from Notepad that way.

It is good when feeds are automatic – the product of some other activity, like a blog. Or maybe I’m a system admin and I want to get notifications from my servers when something goes wrong. The last thing I want is more email, especially from a non-human. Maybe I could write a program that puts system logs into a feed. Then anyone with access could opt in to see what’s up with the server.

Maybe I want to convert my feed from one with MP3 files to one with M4A files? I could read the feed and replace the enclosure tags, maybe add some iTunes tags.

Maybe I upload the school newsletter every week, and every time I do, the system updates the feed with a link to the new newsletter for subscribers.

Maybe I’m a viagra salesman, gaaa, and I want to crap on a feed by inserting advertising. If I was that kind of person and a programmer – highly unlikely – I could suck in a feed, and make every fifth item be an ad, or at the end of every item description I could put an ad. At least I could make it a targeted ad based on the subject matter of the feed.

The tools to make these things happen might be a web scripting language and a database. There are many approaches. PHP MySQL anyone? Each entry is a new database record. The feed is generated every time someone visits a URL by a web script which loops through the database records to produce the feed items. It serves xml instead of html content, as we learned.

What if I’m a sys admin? I am concerned with the feed being somewhat private. First I might deliver feed via SSL https instead of http. That would encrypt the transmission and most feed readers are okay with this. After I get the SSL going, I make sure users have to call the URL with an MD5 feed key instead of a guessable numeric database primary key. This would also facilitate multiple feeds from the same web script based on which MD5 key was passed in.

Ok let’s say I’m not a programmer. I want a desktop program that can make the feed for me. Adding an entry is a manual process. I use a program called Feeder for this podcast feed. Learn more at reinventedsoftware.com/feeder.

Here are some features you’ll want. Of course you want fast programmer-less edits. You want it to use itunes tags when podcasting. You want it to publish the feed for you, like via FTP.

You want it to “ping” services that have to load your feed. iTunes, technorati and feedburner are three examples of services you may want to ping if you have accounts set up with them. If you want them to always have your latest and greatest, you’ll want to ping them. iTunes can be ping-ed with a basic GET request that includes you’re podcast ID, however most pinging happens via an XML POST that contains the ping command. Of course, a good desktop app will keep that behind the scenes.

So I mentioned feedburner.com . They are good for a couple things – reporting and redirecting. They have other services but let’s focus on these 2 free things

Basically you give people a feedburner URL instead of your feed’s direct URL. By doing that, you are free to change your feed’s direct URL without leaving subscribers with a dead subscription. So now feedburner is getting a bunch of requests that they can analyze and produce usage reports for you. Great reporting.

Without feedburner we’re responsible for returning http redirect headers when the feed’s direct URL changes.

When you are forced to put your feed at a different URL, you want to think about redirecting existing subscribers to the new URL. You may not care and your subscribers will get a 404 response. You may care a little and give your subscribers a 410 “gone” response. At least you’re leaving a note, even if it’s “screw you guys”. Don’t leave nasty notes.

A good response is 301 with a header location redirect. Since they ultimately got the feed they were looking for, they may not notice that you delivered it from left field instead of from straight ahead.

If you’re on Apache you can use .htaccess files for redirecting. In the folder with the old feed file, load a file named .htaccess and insert a “redirect permanent” line like

Redirect permanent /oldfeed.xml http://www.domain.com/newfeed.xml

If you just can’t get enough XML, you could return an XML redirect. That would be a file in the old location that only contains redirect and newlocation tags.

Don’t be afraid to dig into the XML flying all around us.