Re: [htmltmpl] Re: [Comment] H::T => using <TMPL_UNLESS> to trigger <TMPL_LOOP>
Brought to you by:
samtregar
From: Cees H. <ce...@si...> - 2004-05-09 15:53:18
|
C Hagstrom wrote: > > At any rate, what I ended up doing that appears > to work was set the editing form up as an included file, and > create a "parent" template up with this code: > > <!--TMPL_IF NAME="intro_error_notice" --> > <!--TMPL_INCLUDE NAME=/path/to/template/edit_form.tmpl --> > <!--TMPL_ELSE --> > <!--TMPL_LOOP EDITRES --> > <!--TMPL_INCLUDE NAME=/path/to/template/edit_form.tmpl --> > <!--/TMPL_LOOP EDITRES --> > <!--/TMPL_IF--> > > I digressed a bit, but I guess the short comment is that I was able > to "switch" the <TMPL_LOOP> on or off using the code above. Another way of handling this would be to still return the loop construct on the re-display, but only pass it an array with one hash in it. This way you only get one entry displayed, and you can remove the extra complexity you have introduced in the example above. > Hope I'm making sense here ... and there's probably much more > elegant ways to do this, but the approach above appears to work > at this point. I don't know if many would consider this more elegant, but I am a believer that simplification is a form of elegance in coding. Then again, I am also a firm believer in "if it ain't broke, don't fix it". So if you have a working system, and you are happy with it, then leave it alone... Cheers, Cees |