in reply to Code and html separation - always or mostly doable?
I have no experience with HTML::Template, but I use Template Toolkit for my templating needs. Skimming through the documentation of HTML::Template, it seems to me that the Template Toolkit has a bit more features which support code/logic separation better, like default values of variables, and more sophisticated control structures.
There is in my opinion practically always a certain gray area where complete separation of code and presentation is impossible. I try to let the program logic be as generic and modular as possible, and let the template present return values from functions or objects in HTML.
What I tend to do in such cases is to build up an html string, and then feed that string, together with other tmpl outputs, to the template file.I just give TT a bunch of scalars, arrays and/or hashes which I want to present in HTML, and let the templating engine deal with that.
Arjen
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Code and html separation - always or mostly doable?
by Joost (Canon) on Jun 16, 2004 at 11:24 UTC | |
by amw1 (Friar) on Jun 16, 2004 at 14:33 UTC | |
by geektron (Curate) on Jun 16, 2004 at 17:49 UTC | |
by elwarren (Priest) on Jun 17, 2004 at 19:14 UTC | |
Re^2: Code and html separation - always or mostly doable?
by davis (Vicar) on Jun 16, 2004 at 10:49 UTC |
In Section
Seekers of Perl Wisdom