[Templates] TT equivilent to Mason autohandler
Mihai Bazon
mihai at bazon.net
Sat Apr 26 17:47:59 BST 2008
Perrin Harkins wrote:
>>
>> When /admin/SOMETHING.html is requested, the toplevel autohandler still
>> gets called. In it, $m->next_comp refers to the second autohandler. So
>> pages will still automatically have headers and footers. In the second
>> autohandler, $m->next_comp refers to SOMETHING.html, but it serves it
>> only if the user has enough privileges; otherwise it'll show the login form.
>>
>> It's an elegant way to write websites.
>
> IMO, it's pretty messy to do things this way. Putting things like
> privileges in your templates means that anyone who wants to understand
> the basic working of your app has to read through all the template
> code. Keeping things like that in your perl code or config file and
> sticking to display issues in your templates makes it a lot easier to
> follow.
Actually, the privilege checking is in the autohandler and any other
template under the "/admin" path get it for free and need not bother
with it. I do find this quite elegant.
But anyway, I just meant to show an example where autohandlers can come
in handy. You're right, this specific example may not be the best thing
to do. :-)
-M.
--
www.dynarchlib.com - the mighty AJAX toolkit
More information about the templates
mailing list