Fozzologs

RSS Feeds

About...

These posts are the creation of Doran L. Barton (AKA Fozziliny Moo). To learn more about Doran, check out his website at fozzilinymoo.org.

Right Side

This space reserved for future use.

This Fozzolog now Template-Toolkit powered

Posted: 8 March 2004 at 02:55:15

I just migrated all the Fozzolog mod_perl code to use Template Toolkit instead of CGI::FastTemplate.

To do this, I had to rewrite all the template files dealing with Fozzolog pages. There are seven of those. Because the Template Toolkit syntax supports more logic than CGI::FastTemplate, I moved as much of the presentation logic as I could out of the mod_perl content handler into the template files.

I believe the move to Template Toolkit makes the Fozzolog code more portable, easier to maintain, and easier to understand.

It’s fairly trivial now for me to fire up another journal site based on Fozzolog code. All I need to do is set up a section in the Apache configuration file with some Perl variables.


  PerlSetVar Fozzolog_DSN dbi:Pg:dbname=joealog
  PerlSetVar Fozzolog_Path /journal
  PerlSetVar Fozzolog_TemplateDir /www/joejoejoe.com/templates
  PerlSetVar Fozzolog_Site www.joejoejoe.com
  PerlSetVar Fozzolog_DateFormat "%a %d %b, %Y at %H:%M"
  SetHandler perl-script
  PerlHandler FGM::FozzologHandler

The PerlSetVar directives provide all the key data needed. Any other customization can be done in the template files.

For the insanely bored, here’s a snippet of a template file:

Date: [% manip.UnixDate(jentry.dt_posted, date_format) %]
Topic: [% jentry.topic_name %]
Headline: [% jentry.headline %]
[% jentry.body %]
[% IF jentry.comment_count == 0 %] No comments [% ELSIF jentry.comment_count == 1 %] 1 comment [% ELSE %] [% jentry.comment_count %] comments [% END %] | Add a comment