[dev] interesting article on templates
Jan Schneider
jan at horde.org
Wed Sep 17 07:30:07 PDT 2003
Zitat von Nuno Loureiro <nuno at co.sapo.pt>:
> I don't quite agree with you because Horde, or at least IMP, has not
> business logic completly separated from the presentation logic. In fact,
> I just realized that when converting IMP to Horde_Templates. Obviously
> an application has both logics separated when you don't need to change
> business logic to change its presentation. Some examples of problems
> about this separation in Horde/IMP are a lot of class methods that
> produces HTML, like:
> - Menu::customItem()
> - Horde::link()
> - Horde::widget()
> - Notification_Listener_status::notify()
> etc.
> These are just some examples.. There's a lot more of other examples that
> break this separation.
These examples actually are presentation logic and can be customized very
easily with CSS. They generate basic single tags that can't simply be
replaced with other tags by designers. They (the designers) can only
influence the appearence with the useage of style sheets.
> >(...)
> > We do want to be able to have things like Horde_Mobile, though, and to
> be able
> > to easily change the UI of an application like IMP. I just don't think
> > Horde_Template is the way to do it, though.
>
> What I've tryed to do so far, and I have some new stuff done, was to do
> both things at once, i.e., -separate both logics, and -"templatatize"
> the presentation. Now I realized that this task would had been a lot
> more easier if I splitted it in 2. I should have done in first place,
> the separation between both logics, and only after its commit, proceed
> with the templatization.
>
> I think the first part (separate both logics) we all agree, at least in
Correct. So whatever decision will be made, your work shouldn't be lost. If
you see any chance to still split this step up, we will happily apply your
patches for this step anyway.
> theory. I think we might disagree about the second part
> (templatization), and this is what I disagree with Brian's article. Not
> thinking only in Horde, but thinking widely, you have some advantages in
> having a templating language over using PHP, like:
> - You can have a separate department or team or outsource the interface
> and you don't have several security concerns because the template
> language is rather limited, comparing with PHP.
See Chuck's comment.
> - If later you want to change the main language of your application, the
> interface doesn't need to change at all.
Not very likely.
> - You can do template parsers in more languages, than PHP.
Is there any need for this? Especially in the Horde applications?
> - In a company, like where I am, that lots of sites are made in perl and
> some in PHP, you can have a unique templating system and you only need
> to teach to designers a unique and simple "language".
Good point. But only valid if indeed a unique template "language" is used.
And we use a proprietary template engine in Horde, so this is a null
argument.
> - And like Brian says, a templating language is a bit simpler than PHP.
But indeed only minimal if you clearly sepearate business from presentation
logic in the templates.
> At least for me, those reasons are worth for using a templating system.
>
> I'll send one more time, in a near future, a set of patches (after the
> last changes I've been doing) to convert menu, quota, login, mailbox and
> the master template and the compilation class. If of course, you really
> decide that you don't want to follow that path, I'll split my tree to
> continue my work in a non-contributing way (I only mean with that, that
> I'll do more oriented to what I want and with more freedom). I really
> understand if you don't want IMP with horde_templates, because I know
> it's a big change to the application. I just can't agree with you that a
> template system is not "meant" for big applications. I do agree that a
> big application that was not made from start with that in mind, could be
> really complicated to transform, and couldn't worth it.
>
> Any thoughts, opinions?
As there is at least one point we agree on, it would be great if you could
send patches that do the discussed separation without switching to
Horde_Template. We'll see where we go from there.
Jan.
--
http://www.horde.org - The Horde Project
http://www.ammma.de - discover your knowledge
http://www.tip4all.de - Deine private Tippgemeinschaft
More information about the dev
mailing list