Re: yet another template
| From: | Wolfram Kriesing | Date: | Wed, 07 Nov 2001 17:26:50 +0000 |
| Subject: | Re: yet another template | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-2605@lists.php.net to get a copy of this message | ||
> Don't be so fast. There were some plans about creating a unified
> template API for all template engines in PEAR. I think it might
that's something i like
i was also already thinking about that, it should be doing something
like the PEAR::DB does just for templates, right?
but since all the different template classes have very different
functionality inside it will be quite hard, wont it?
i.e.
in smarty you say inside the template
{$value|truncate:30}
which truncates the content of $value after 30 characters
now if you rely on this and switch to ITX you will have to do that
when passing the value to the template
someting like: $tpl->setVariable('value' , substr($string,0,30) );
so how much abstration shall the unified template API do?
or did i misunderstand it?
here is one of my ideas for this API
instead of
$tpl->setVariable( 'value' , $string );
to be able to do this
$tpl['value'] = $string;
and for a block/section/whatever-its-called
you only need to say
$tpl['blockname']['value'] = $string;
- this way i can also see where i am putting stuff, i dont have to
search for the 'setCurrentBlock' in the code
- i can use those variables
- an XML can easily be converted to that (since that is a tree)
- i can generate xml out of it
- ... and whatever i didnt think of
and the engine/API does the setVariable or alike
--
Wolfram