Re: working on a template system...
| From: | tedd | Date: | Wed, 28 Jun 2006 18:07:05 +0000 |
| Subject: | Re: working on a template system... | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238825@lists.php.net to get a copy of this message | ||
At 1:55 PM -0400 6/28/06, Jon Anderson wrote:
>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
Not at all, if I see it my way:
<dl>
<?php
foreach ($display_variable as $key => $var)
{
?>
<dt><?= $key?></dt>
<dd><?= $var ?></dd>
<?php
}
?>
</dl>
But, as the old lady kissed the cow "To each their own."
tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com