The Web Realm
     Marc Chadwick's Weblog
 Local: Home About Contact
Wishlists: Books DVDs Thinkgeek 
Syndicate: RSS RSD Atom

 Dirty hacks
Development 

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.

 Comments:

Leave a comment

 

February 2008
Sun Mon Tue Wed Thu Fri Sat
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29  


Recent Entries
# links for 2008-02-10
# Biofuels Do More Harm Than Good
# del.icio.us
# That'll do it
# Under Construction
# Revamp
# GooSync
# Trusting Google
# Play AACs on your TiVo with TiVo Desktop from a Mac
# My Once and Future Cloud
Flickr Photostream
www.flickr.com
Categories
Apple
Aquarium
Banking
Blog Stuff
Bookmarks
Books
Boston
Comedy
Comics
Development
Drama
Entertainment
For the Mac
Hacks
Hardware
In The News
Internet
Linux
Mobile Phones
Movies
Music
Open Source
OS X
Politics
Red Sox
Science
Security
Software
Sports
Stuff 'n Junk
Sysadmin Stuff
Technology
Television
Testing
Thoughts
UNIX
Vermont
Virii
Windows
Tags
blog  cloud  development  bookmarks  google  code  email  global warming  gmail  google calendar  news  organization  politics  science  study  symbian  tags  test  web 2.0 
Archives
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
March 2007
February 2007
January 2007
December 2006
November 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
Guest Posts
Blog for America
Boston Metroblogs
Links
802 Online
Blog for America
Boston Metroblogs
Dream Theater Info Network
Dr. Mosh
Engadget
Gizmodo
Lukwam
Mac OS X Hints
The Register
SAGE
Skadz
Slashdot
Kevin Smith
Powered by Movable Type Publishing Platform
This blog is licensed under a Creative Commons License.