February 12th, 2006

A few months back I wrote a simple Python script to help me maintain this site, once I decided that www.fiddlerelf.com would be a static site, not a dynamic one. That means that everything you see and every page you read is a real page on a web server, (aside from the maps, which uses a technology called Ajax to populate information dynamically.) So other than the maps, each page exists the way you see it, all the time.

The converse, a dynamic site, is an application on the server that takes your request, fetches information from some data source, and formats the HTML page on the fly so you can read it. I’ve worked with PHP, ASP, and to a lesser extent JSP and Java servlets in creating dynamic sites. After I visited the Computer Science Department site at the University of Colorado at Boulder and saw how vast and nice their (static) site was, for my own personal site I decided that every page should be static.

Of course, I’m not (completely) crazy. One of the benefits of using something like PHP or ASP is that you can encapsulate all your visual logic, so you don’t have to keep repeating all of the layout HTML code over and over and over again - so when you want to change one little thing, you don’t have to change it over and over and over again. The idea to write a script that would allow the same type of visual encapsulation provided both the reason and incentive for me to finally learn Python, which is a win win.

Now, when I want to change something in the layout, I can change it in one place, a template file, and then rebuild all of the pages that use the template. And I also now know how to use Python. See? Win and win.

Back full circle, last night I was thinking about putting pictures up on my site. My girlfriend takes a ton of pictures, and it seems like a good idea to chronicle stuff on the web. After all, that’s pretty much what it’s for now.

How to do it though? Well how about a way of making a bunch of HTML files that link together as a slide show from a simple directory of pictures? Hell, how about Python! It worked before, and it’s going to work again (I said to myself).

Now I have a script that you put into a directory of pictures, with a template HTML file, and run. The end result is your template with the slideshow embedded. Have a look.

Leave a Reply