Re: [htmltmpl] A valid reason for template support for select lists?
Brought to you by:
samtregar
From: Roger B. W. <ro...@fi...> - 2003-10-19 22:43:00
|
On Sun, Oct 19, 2003 at 12:53:24PM -0700, Mark Fuller wrote: >I just found html::template and it's exactly what I was looking for. The >only thing that is a minor shortcoming for me is the inability to do option >select lists. I understand the emphasis on keeping a template a template >(and languages separate). But, here's an example of why I believe it is >justifiable to provide for an "if" inside the variable loop that would emit >an option list. You know, you can do it quite easily without extending HTML::Template. Here's how I do it. Say I have modes "a", "b" and "c", each of which will produce different text. (Never mind different languages - I use this trick for whole different pages in a multiscreen application.) Then I just turn off die_on_bad_params, and set: $tmpl->param(mode => $mode, "mode.$mode" => 1); Then the template has: <tmpl_if name=mode.a> text for mode A </tmpl_if> <tmpl_if name=mode.b> text for mode B </tmpl_if> ...and so on. You get the idea... Roger |