Snow and ice have been falling. Schools are closed. It’s a snow day! Since I didn’t have to go into work, I felt it was a good opportunity to spend a little time working on a programming project for work that I’ve had on the back burner.
One of the things I have to do at work it post the Library’s monthly new acquisitions list. I used to just forward the Excel file produced by the Tech. Services department to the webmaster who would convert it to HTML and post it to the web site. Since the Seminary’s website transitioned to a Content Management System that gives me editing access, I got to take over the HTML conversion process. Much to my chagrin, however, I found out that the conversion process involves a lot of manual copying and pasting in Excel, using a formula to concatenate the various fields into the final product, and then a series of search-and-replaces to clean up special characters and blank lines. I had hoped that there was just a program that I could run the file through to format the data with the necessary HTML tags, so that’s what I set out to do.
I’ve long wanted an excuse to start learning PHP, and this seemed like a good problem to solve via a simple PHP web app, so I started Googling for example PHP code for processing tab-delimited text files, handling special characters, and receiving web form input. I also dusted off my copy of the very handy PHP Function Index application, which provides an interface for viewing, searching, and browsing PHP’s documentation. After a few false starts, struggling to understand some new functions, and debugging a few errors, my first PHP application, HTMLified Acquisitions List Generator, was done.
Now I have a simple web app where I can select a tab-delimited text file containing the acquisitions data in the proper order, and the application will spit out HTML code that I can simply paste into the “Recent Acquisitions” page.