Ah, development. How I love it. Or hate it, really depending on what I'm doing and when I'm doing it. PHP has a tendency to be very frustrating when the coder isn't used to working in it constantly. Still, I rewrote a couple of "hacks" today that I had written for Blog for America. Of course, at some point early on the decision was made to cut out PHP support for the server and these hacks were removed, their code lost.
The first of these hacks is all about authors. Its a silly thing for me to spend my time on, really, since I'll almost certainly be the only author, but I did it. Basically this hack displays an entry author's nickname if it exists and their username if not. This means some degree of obfuscation if desired, but doesn't require it.
The second of the hacks is all about my blog roll. I created a second blog and set up three categories -- Bloggers I Know, Bloggers I Don't Know, and External Links. Look familiar? They're the same as the categories on the left hand side of this site. I use MovableType's bookmarklet to post interesting sites to this blog. I archive it by category.
I use a PHP include to include the flat file of the category archives for this blog. The template for those category archives is special. With PHP, I created a keyed array of all the posts using the entry title as the key and entry body as the value. Next I sorted the array by key. Finally, I loop through the array and output everything, with a slight indent, as I prefer indentation, and unset the variable. The last step is crucial, lest you just continue adding to the same array each time you include that PHP code.
Of course I'm also tweaking little stuff here and there. Since I haven't built the contact section of the site yet, feel free to drop a comment if you're interested in getting a copy of the code. I'm happy to share.
Leave a comment