I'd like to be able to serve TT2 templates from a database. The FAQ suggests that I need to subclass Template::Provider. Has anybody got a simple example of doing this? I've poked about in the source for Slash but that confused me.
On the subject of TT2, does anybody know when the book will be released?
See slashcode
merlyn on 2003-12-22T18:45:35
Slashcode does this.
OpenInteract copied slash...
lachoy on 2003-12-22T21:16:05
...at least for the introductory stuff. Looking back at the
code in OpenInteract 1.x it's actually pretty well commented and may give you an idea of what to do. Everyplace where it refers to a 'SiteTemplate' object just substitute 'database record'. It's a good idea to put this in an object because you may find that database access isn't all that great for your needs -- filesystems are very efficient
:-)
One note: OI has a custom Template::Context object which interprets templates with a package::name format for its own uses, so calling something like:
[% INCLUDE mypackage::mytemplate %]
will do the right thing ('package' in this case being an OpenInteract package, not a Perl package).
Ask Me
pudge on 2003-12-31T19:47:02
I did the work for it in Slash, you can pick my brain if you wish.