Archive for the ‘PHP Scripts’ Category

Sort any XML file in PHP with one XSL

Friday, September 3rd, 2010

I feel I’ve now earned the particular distinction of having participated in a cage match with an XML file and beaten its bloody face in. Sure, they’re pretty nifty for storing collections of data and laying them out on web sites, but you don’t get the full experience until you have to create a web interface to edit, insert, delete, and sort said XML file. Honestly, it would have been easier just to store the data in a PHP array. But hell, I love a good cage match! My biggest problem was that anytime I would edit or insert an event element, it would appear in the XML file as the last node rather than in date order. I figured out how to sort the XML contents as they were rendered in HTML using an XSLT (EXtensible Stylesheet Language Transformation). This worked fine for one display but sadly, this XML needed to be displayed several different ways in different places and I wasn’t thrilled with the thought of having to create an XSL file for every variation. All I really needed was one XSL file to sort the XML data each time it was updated. So I wrapped rope around my hands, coated them with resin, dipped them in broken glass, and stepped into the cage.


Posted in PHP Scripts | 11 Comments »

Custom WordPress Plugins

Wednesday, August 25th, 2010

WordPressI was looking through my site stats over the past few weeks (nothing to brag about I assure you) and noticed a disturbing trend. Most of the hits on my blog are the result of searches for various topics. I realized most of those topics are related to blog posts which no longer display on my site homepage. I imagine most people are really confused as to why my site came up in their search results if the page doesn’t mention what they are looking for. I suppose I could have put a search box on my site, but I’m not particularly fond of them and besides, my site only has like 25 posts max so there really isn’t a lot of content. I currently only display the seven most recent posts on my homepage. I wanted a way to provide links to the posts which have fallen off the homepage. I couldn’t find a plugin that would do this for me, so I decided to write my own.


Posted in PHP Scripts, WordPress | No Comments »

Twitter Search parser in PHP

Wednesday, July 28th, 2010


I’m feeling a bit uncomfortable right now, like I’m about to change clothes in a public dressing room whose walls don’t go all the way to the floor. Other than the occasional unsettling dream, I’ve never really thought about what it would be like; taking that part of you which is always hidden and private and putting it on public display. There really shouldn’t be anything to fear right? I’ve seen others’ and mine appears similar to theirs. Maybe mine has some weird lumps or is a little misshapen. Ah hell, no one ever reads this blog anyway. Time to lift the hood and show you all my soft and squishy goodness! Here’s some PHP code I wrote (and partly frankensteined) to parse and display a twitter search.


Posted in PHP Scripts | 3 Comments »