Welcome!
Thanks for visiting. If you found this information interesting or useful (or you think I'm dead wrong about something) I'd like to invite you to leave a comment on this post. You can also
subscribe to my RSS feed or sign up for email updates on the right-hand side of the page.
If you Digg what you StumbleUpon, find my writing del.icio.us, or are one of the Technorati, you know what to do:
Template Toolkit: how to generate static HTML on any path
My company generates our website using Template Toolkit’s ttree tool. We want our site to be built with absolute paths in the HTML, so we need to be able to accomodate that with file:// URLs when we test it. We use code like this:
The script to invoke ttree in our testing environment:
#!/bin/bash
cd `dirname $0`
rm -r ./out_test/*
ttree -a --relative --pre_process=./lib/config.test \\
--pre_process=./lib/config.common \\
--define basedir=`pwd` \\
-f ./lib/ttree_test.cfg
In lib/config.test:
[% root = 'file://' _ basedir _ '/out_test' %]
In lib/config.deploy (when we build for production):
[% root = 'http://www.ideaworks.com/' %]
This way, rather than hard-coding the testing path in lib/config.test, it Just WorksTM.
Related posts:
- Dynamic CSS/JS/HTML in Template Toolkit wrappers I’ve been asked about this a few times on #tt,...
- My first CPAN acknowledgement It’s a small thing, but I’m listed in the acknowledgements...
- Debugging long-running perl programs in Debian One of the slicker ways I’ve seen of trying to...
- Extracting the next 7 days from phpiCalendar to simple HTML Edit: Newer versions of phpiCalendar give you this feature without...

