Re: Re: smarty
| From: | Enrico Weigelt | Date: | Wed, 14 Apr 2004 15:53:48 +0000 |
| Subject: | Re: Re: smarty | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183339@lists.php.net to get a copy of this message | ||
* Justin French <justin@indent.com.au> [2004-04-15 00:37:41 +1000]:
<snip>
> You must remember, Smarty is just a layer over PHP. All the functions
> that you've listed exist in pure PHP code somewhere. It would
> relatively easy to code equivalent templates in PHP.
Yes, you're right.
But then it should not be called a template engine, but instead a special
php dialect.
> Taking some random examples from your list:
> {foreach from=$custid item=curr_id}
> id: {$curr_id}<br>
> {/foreach}
> becomes
> <? foreach($custid as $curr_id): ?>
> id: <?=$curr_id?>
> <? endforeach; ?>
Well, in patTemplate this is much cleaner and easier to understand
for non-programmers.
template:
<patTemplate:tmpl name="foo">
blah
<patTemplate:tmpl name="list">
id: {id}
</patTemplate:tmpl>
</patTemplate:tmpl>
code:
$tmpl->addVar ( 'list', 'id', array ( 1001, 1002, 1003, 1004 ) );
$tmpl->addVar ( 'list', 'name', array ( 'joe', 'jack',
jane', 'charlie' ) );
cu
--
---------------------------------------------------------------------
Enrico Weigelt == metux IT services
phone: +49 36207 519931 www: http://www.metux.de/
fax: +49 36207 519932 email: contact@metux.de
cellphone: +49 174 7066481
---------------------------------------------------------------------
-- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting --
---------------------------------------------------------------------