February 25, 2005 5:36 PM
Wheee! Fooling around with XSL stylesheets and PHP is finally paying
off.
XML has always interested me. Separating data from presentation by converting the browser into a proper data parser is fascinating. I've been reading up on SOAP and XALAN. It's easy to appreciate the elegance of the XML idea by looking at this site's RSS feed. Instead of displaying the raw code for the RSS format, it should display a nice CSS formatted document warning newbies that this indeed is an RSS feed and is meant for RSS aggregators. The secret behind the magic conversion is an XSL (XML Stylesheet) file. You can specify which data to display where, use loops etc. in an XML like syntax. Take a look at rss.xsl if you're interested. It uses the same style sheet as this site. I've found the article Making RSS Pretty pretty useful. Of course, knowing XSL always helps.
The reason why I haven't completely switched over the entire site to
XML1 is simple; some features don't work well when the content is
served as XML . The scariest problem of them all is if the page does
not contain well formed XML. Then, it simply won't render; instead an
error will be displayed. That to me, is like walking on a
tightrope. Also, javascript's document.write
calls won't work. Read
more about such XML issues in the article
The perils of using XHTML properly.
PHP is widely used to power dynamic websites. I got to learn a bit of PHP2 while writing the SearchPage. It uses a keyword index dumped by an elisp script to search through the blog entries on this site.
Taking a deeper dive into the world of PHP, I've come up with a simple commenting3 system to complement the blog entries on this site. It currently has only basic features. Try it out by clicking the "Comments" button following this entry.
Spam and security issues are a major concern and I sincerely hope that this script isn't too vulnerable. If anybody has any suggestions/ideas regarding the commenting system, feel free to comment.
Also, I've added categorization support to my blog module. It does make finding entries easier.
[1] As in, make all html pages .xml. That, actually is necessary for
me to use the valid XHTML logo. Boo hoo.
[2] It's hard to survive in the present world without knowing a bit of
PHP and MySQL.
[3] Though I wonder if anyone will bother to comment, apart from the
spammers.