For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > March 2005 > Re: [PEAR] Re: template, not template that is the problem.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] Re: template, not template that is the problem.
Alexey Borzov

2005-03-26, 8:57 am

Hi,

Lukas Smith wrote:
> this has severe divantage however since it does incurr a performance
> overhead that can be countered by caching. another divantage is that
> it doesnt allow any loayout relevant logic. meaning you need to add
> another layer to truly separate business from layout.
>
> for example its not easily possible to give the designer the choice to
> use alternating row colors without using another layer or embedding the
> necessary logic in your business logic.


In fact ITX and Sigma allow one to embed callback functions into the template
(the callbacks in ITX are limited and not documented, though). The usage example
from Sigma docs shows how that can be used for doing the alternating row colours
trick you mentioned:
http://pear.php.net/manual/en/packa...ntro-syntax.php

Of course the programmer has to write functions to process these callbacks, but
after that the designer can do everything himself. And all presentation logic
like the fact that row colours are changing and the colours themselves are kept
in the template.

The same technique can be used to embed e.g. gettext() calls directly into the
template.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com