On Sat, Apr 26, 2008 at 6:20 AM, Mihai Bazon <[EMAIL PROTECTED]> wrote:
>  Now, in /admin/autohandler you can have the following:
>
>  % if ($has_admin_privileges) {
>  % $m->next_comp;  # display admin page
>  % } else {
>  ... display login form ...
>  % }
>
>  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.

>  I wish TT had something like this.  OTOH, this might be simply out of
>  the scope of TT (such functionality should be implemented in the
>  mod_perl handler and not in the template system).

Yeah, exactly.

- Perrin

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to