Re: [Phplib-users] template.inc patch (IF/ELSE/ENDIF)
Brought to you by:
nhruby,
richardarcher
From: J C L. <cl...@ka...> - 2001-12-31 03:33:38
|
On Sun, 30 Dec 2001 13:20:59 -0500 (EST) nathan r hruby <na...@ds...> wrote: > On Sun, 30 Dec 2001, Tarique Sani <ta...@sa...> wrote: > I agree with the no logic in templates rule, it makes things very > complicated in terms of designing, espically when the descsions > could be made at the app level. This, in some ways, promotes bad > application design. Giving power to HTML jockeys also scares the > bejesus out of me ;) <nod> > That said, I can also see the use for condtional statements in the > tempalte system, there are times when it can be incredibly handy > (changing colors for roms in a table, lets say) and doing it at > the app level is harder and can, in some cases, cause addtional > unneeded overhead. This can be extra true (if there is such a > thing - true++ :) if you are given a codebase that just won't do > what you need it to do without serious reworking. I seem to specialise in finding those cases. Certainly I've been using IF/ELSE/ENDIF support in templates for the last two years now and loving it for a ugly corners it elegantly gets me out of. > JC, would you be willing to rework this patch as an extension > class to the current template class? Will you accept the backslash patch (already on SF) separately then? Its a good patch and should be accepted. > I'd be happy to include that as part of the phplib distribution, > and I think that it will make many people happier, not having to > have the condtional code in the class if they aren't using it. While I don't mind doing a derived class for this, it seems a little questionable in terms of supporting reason. Adding conditional support requires adding an if() to subst(), a new method preproc(), and a matching global to turn it on/off. Given how lightweight the patch is, and that its effects can be turned off (and probably should be off by default), I don't really see the value in abstracting it -- that just means that I/someone then has to maintain both versions of subst(). > This also makes maintenence of both bits easier for all of us. > I'd be happy to provide you with CVS wrote access if you'd like to > maintain it as well (though I could swear you have it already, > no?) If I do have CVS access its news to me (or news to those tired forgetful neurons). I guess I can maintain the conditional stuff if you want... -- J C Lawrence ---------(*) Satan, oscillate my metallic sonatas. cl...@ka... He lived as a devil, eh? http://www.kanga.nu/~claw/ Evil is a name of a foeman, as I live. |