in reply to HTML::Template question.

The way I've solved similar problems is to load two seperate HTML::Template objects. Instead of the <TMPL_INCLUDE>, it's instead a <TMPL_VAR> that is filled in with the data from another HTML::Template object. Not particularly elegant, but it works.

It'd be nice if HTML::Template had something like a switch statement so these things could be dispatched easier, though I suspect the developers would be very hesitant to add one. Code-and-data-are-seperate, and all that.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

: () { :|:& };:

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: Re: HTML::Template question.
by jdtoronto (Prior) on Nov 17, 2003 at 19:21 UTC
    You've hit the nail on the head.

    I could pass the FORM TEMPALTE through CGI::FormBuilder, parse it to recover the JS for the HEAD and put that into one <TMPL_VAR ...> and the put the HTML for the BODY into another <TMPL_VAR ...>. Sounds like a not so difficult piece of code.

    I just got an email back from Nathan Wigger (author of CGI::FormBuilder) to say that in v3.0 you will be able to pass a HTML::TEmplate object into FormBuilder, this would make it trivial.

    See, amazing what a fresh brain and another mug of coffee can do to a problem :)

    jdtoronto