Playing With EE Again

Six months to a year ago I got an interesting email from someone asking about historical gun show listings.  This fellow needed to figure out the date of a show back in 2002 or 2003 (I think it was), and that was back when I was still maintaining the list using a static HTML page.  This had something to do with an IRS audit, although I didn’t get the details.  I sent him the files I could find in the archives and hopefully he survived his meeting with the IRS.

Anyhow, one of the things that I’d been trying to decide how to handle was the issue of old show listings.  Sometimes it’s good to be able to look back to find the exact date of a show, such as when you’re trying to remember exactly when you bought something.  The problem was that while it’s technically possible to incorporate the old listings into the main page, it would be horribly cluttered (they go back to May, 2004 in the database).  My current solution to keeping the main page uncluttered was to set the post expiration date to one month after the show.  That way they’d stay around for a month and then disappear from the listing.  They would still be Open in EE, just “expired,” so every so often I’d go in and do a mass Close on them (it makes finding and working with current listings easier, since I can search for just Open items).

I copied the main Index page template to a new one called “history” and modified the selection criteria and tweaked the display a little (I decided to use nested unordered lists instead of a table) and fairly quickly came up with a history page.

I have become more and more impressed with the capabilities of the EE weblog module over time.  All it took was tweaking the “entries” loop a little and adding the list tags on the date_heading and date_footer to get everything properly enclosed:

In the above, “exp:weblog:entries” causes a loop over all entries in the blog called “dfwgun” that are closed (or expired) and ordered by date (oldest first).  Everything between it and the closing tag gets repeated once for each entry, except for the “date_heading” and “date_footer” tags, which get inserted in the loop anytime a new month boundary is crossed.  All of that stuff generates the following:

While I was in there I also did something similar to display the list of promoters from the database.

Update: changed code to image from blockquote (less messy).

Comments are closed.