Re: working on a template system...
| From: | Jon Anderson | Date: | Wed, 28 Jun 2006 17:55:00 +0000 |
| Subject: | Re: working on a template system... | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238818@lists.php.net to get a copy of this message | ||
I really don't understand why people have such disregard for PHP as a template system... I'm not saying one way is better or worse (it's really a matter of preference), just that the PHP way isn't implicitly bad or messy...
/* The Smarty way */
$smarty->assign('display_variable',$display_variable);
...
{* template *}
<dl>
{foreach key=key item=var from=$display_variable}
<dt>{$key}</dt><dd>{$var}</dd>
{/foreach}
</dl>
/* The PHP way */
<dl>
<?php foreach ($display_variable as $key => $var) { ?>
<dt><?= $key?></dt><dd><?= $var ?></dd>
<?php } /* end foreach ($display_variable) */ ?>
</dl>
Is it really *that* bad?
jon
Martin Alterisio wrote:
2006/6/28, Robert Cummings <robert@interjinn.com>:On Wed, 2006-06-28 at 07:32, Martin Marques wrote:On Wed, 28 Jun 2006, Ligaya Turmelle wrote:Martin Marques wrote:Because.... it's a mess.Or just use PHP...Why not try to use one of the template systems that already exist? HTML_Template_IT, Smarty, etc.Agreed. Mr. nail, come meet Mr. hammer :BAnd keep Mr. hammer away from Mr. finger