Wild Hair Programming

There’s something about travel that makes me procrastinate unpacking when I return.  So after getting in from Amarillo yesterday afternoon, I walked the dog (who was a bundle of energy after being pent up in the back seat of the Avalanche for 6 hours), stopped for dinner at Sonic, and then settled in at the computer to check up on my neglected email.  Someone sent me an email asking if I was going to be continuing the gun show listings in 2006.  I had been intending to do so, but kept putting it off.

I started checking websites and adding listings, but the way it’s set up it’s kind of a PITA to add new listings.  The form has 10 items to fill in for each show.  I started fiddling with the setup and changed some of the entry fields to drop-down lists that were prepopulated with the promoters names, URLs, and phone numbers.  This was better, but still not great, since the entries weren’t linked in any way (i.e. it was up to me to make sure I didn’t pick one promoter’s phone number and another’s URL for the same entry). 

The idea of linking the information together reminded me of a new feature I’d read about in Expression Engine 1.4:  Related Entries.  This allows you to link an individual field in one weblog entry to an entry in another weblog.  Now a weblog in EE isn’t necessarily what we think of as a weblog.  It doesn’t have to be a “diary” sort of thing.  It’s really just a container for a set of records.  EE provides a standard set of fields and you can also define your own. 

I upgraded to EE 1.4 and started by creating a new “weblog” for gunshow promoters, which contained the promoter’s name, URL, and phone number.  I changed the “promoter” field in the gunshow weblog to point to the promoter weblog and modified the gunshow weblog templates to get their information from the related entry.  Now instead of filling in three entry fields, I can select one entry from a drop-down on the EE publishing form.

The issue of gunshow locations was a bit more messy than the promoter’s basic information.  In many cases a promoter has their own webpage for a given location, so I try to link to that (e.g. Bob Norman and High Caliber both use Will Rogers, and each has a separate URL, based on which promoter is running the given show).  I created another weblog for the locations and created entries for each valid combination of venue+promoter.

Finally, I changed the ending date for each show to take advantage of the new date type fields provided by EE 1.4, which allowed me to remove the custom PHP code I had been using to display the date.

All the above was accomplished in about three hours.  I didn’t set out to upgrade the EE installation and redo everything.  I just sort of got sucked in.  But at least it was a pleasant diversion to having to unpack.

So far I have to say that I’ve been fairly pleased with each new release of Expression Engine.  Each time I upgrade I find that I end up removing bits of the custom code that I had originally added to do something that EE’s creators hadn’t planned.  And the upgrades have been fairly painless in that all it takes is uploading the new files and running an upgrade script.  The only breakages I’ve had were in places where my custom code conflicted with the new EE feature that replaced it.

Comments are closed.