Tuesday, April 04, 2006

Thingamablog & Dynamic Lists etc

One gripe I have always had with blogging tools like TAMB is the fact that the templates are essentially static. So when I edit one of my lists, say the favorites links list, then the entire blog has to be republished. This is particularly true of TAMB.

Yesterday I finally decided to try and make this a more dynamic process.

I used a separate JavaScript file to store my links and used document.write() to dynamically populate the page HTML at run time in the browser. Now if I wish to add a new link to my list I just have to edit the JavaScript file and upload it to the website. Voila! Dynamic lists! Or as close as it gets

My Javascript file looks like this:

//
// Dump my Favorite Links into the sidebar.
//
function whatHo_FavLinks( ) {
document.write('<div class="sidetitle">Favorite Links</div>' ) ;
document.write('<div class="side"> ' ) ;
document.write('<a href="http://www.satpathy.in/">Satpathy Home Page</a><br>' ) ;
document.write('<a href="http://sermonsonstone.blogspot.com/">Oracle Book Club Blog</a><br>' ) ;
document.write('<a href="http://pupu1972.blogspot.com/">Sandip Blog</a><br>' ) ;
document.write('<a href="http://tanushreep.blogspot.com/">rideo, ergo sum</a><br>' ) ;
document.write('<a href="http://rakeshkumar.wordpress.com/">Rakeshs Place</a><br>' ) ;
document.write('</div>' ) ;
}

Now I am not a JavaScript expert. Just know enough to hack something together. Anyway the whole thing works.

Opps. I forgot the TAMB template part. In the templates files I have to call my JavaScript function whatHo_FavLinks() in the place I want the favorite links to go. To do this I created a Custom Tag in TAMB and inserted that into my templates.

No comments: