blog
HOME · CREATIVE · WEB · TECH · BLOG

Saturday, April 7th, 2007

Label Lists for Blogger Templates

For a while I've been wondering how to insert the list of labels on a blog other than using the widget blogger.com supplies. The problem is that the widgets don't work with the old style templates which you have to use if you're publishing your blog to a site other than blogspot.com via FTP.

I've played with the new "layout" functionality on "new blogger" and I have to say it's impressive (everything is database driven - so there's no more republishing all the files for your blog), but the layout functionality just isn't an option unless you're hosted on blogspot - everyone else is stuck with old-style templates...

Something told me that there must be a blogger template tag you could insert, since whenever a post has a label blogger will republish just about every file in your blog that has anything to do with any label, but when you publish a post without labels, just the basics are updated (the atom feed, the home page, the archive page, and the blog post page). However, I never did find the tag that just hast to be there somewhere, but I did find another way to achieve the same goal...

Finally at long last I did find a post by Lee Robertson that explains what to do, but you'll need to have PHP installed on your server and be able to make PHP execute in .html pages.

One word of warning however... Do not use this method unless you have at least some form of authentication for the comments that are posted on your blog, otherwise someone could post some PHP code in a comment which would do bad things when visitors come to your page.

I won't repeat his source code here, but will mention that if you need to set up Apache to do PHP processing on .html documents, then you'll need a line like this in the VirtualHost file for your site:

AddType application/x-httpd-php .html

If you use an extension other than .html for the main page of your site, then you should have a similar line for that extension as well.

Tags: ,
Categories: Blogging, Web Application Development

Leave a Reply

HOME · CREATIVE · WEB · TECH · BLOG