On Thu, Jun 21, 2001 at 11:40:25PM +1000, Ian Brayshaw wrote:
> I guess that's why I'm not a TT fan: I don't consider it to be the role of
> the template/presentation layer to call the programming/logic layer. It ends
> up being another layer of programming on top of programming.
Me neither. I like a much more structured approach. TT, like Perl,
lets you do it more than one way.
When I'm doing a quick 1 or few page site, I tend to hack it up quickly
and roughly. If it's going to start off, or is likely to grow big, then I
tend to build more structure in from the start.
Most of the time, I refactor things as they get more complicated.
For example: I start off having a hash array 'myorg' defining useful
things so that I can do things like this:
[% INCLUDE userinfo FOREACH user = myorg.users %]
and then later I change it to:
[% INCLUDE userinfo FOREACH user = myorg.users %]
(the difference being that 'myorg' is now an object which implements
the 'users' method to return an iterator to fetch a list of users from
a database in a lazy manner)
This is (part of) what separating content from presentation is about.
It goes a lot, lot deeper than not embedding programming langauge
fragments in your templates. My presentation (templates) are
entirely independant of my underlying data and application implementation.
It is entirely appropriate that the presentation layer should pull
data through an application layer (as in this example) if the application
detail is well hidden from the template, which in this case it is.
> TT as a programming tool is OK. You can write some pretty cool programs with
> it. But that's a different kettle of fish to presentation, and is perhaps
> better done in native Perl.
>
> TT: you either do or you don't.
TT: you can, but it's not mandatory.
:-)
A
--
Andy Wardley <[EMAIL PROTECTED]> Signature regenerating. Please remain seated.
<[EMAIL PROTECTED]> For a good time: http://www.kfs.org/~abw/