My homey Chad has introduced me to the usage of XML. At first, I really didn’t know much about it besides the fact RSS feeds use it. But now the more I learn the more I love it.
When we wrote the logs for Gear, we had a couple of choices. We could bloat a MySQL database with tons of log events, write it all to a flat file, or devise something new. Which chose the latter and our answer was XML. With the ability to store attributes and content, have parents and all sorts of hierarchy… its easily one of the best decisions we’ve made.
But when we get back to the topic of having the website and game servers talk, we run into a hiccup. All our events are stored in different sub tables; which means the log has a tables like <chatlog> and <eventlog>. Yeah that’s all fine and dandy, and we love how it turned out… but what happens when people want to view said logs? They aren’t shuffled together in chronological order… they’re all separate. SHIT FUCK DAMN!
Putting them together in order wasn’t as easy as it should have been. Well actually I’m lying; it was easy once I figured out how to do it. That’s the thing about programming/scripting/developing custom shit: its not that the syntax or platform limits your ability to do something, or that it requires butt-loads of work… its being creative enough to figure out how to fucking do it. WHRY?!? Because not everything you want to do has been done by someone else in easy copypasta format.
When I started working on it I was looking for some PHP command that automagically did it for me, and I think that was my problem. When trolling the PHP manual website and furiously searching Google for “put my XML in order” was no help, I decided to do it on my own.
The only thing left was to display the data in a readable format. So mix in a tad of HTML, add a pinch of CSS… blend until sexy and you’ve got a finished product!