Re: working on a template system...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Martin Alterisio wrote:
> 2006/6/28, Jon Anderson <jon@xxxxxxxxxxxxxxxxxx>:
> 
>>
>> 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
>>
>> [snipage]
>>
> Have you (all of you questioning the use of templates) ever worked in a
> project with more than one developer, where part of the team ARE NOT
> coders?

I have.

> WE understand code, but that's not the case for everyone else. Graphic
> designers don't like code, they even don't like html for crying out loud (I
> think they have a good point there btw). Editor, writers, marketing people
> they all give a damn about php and the like, but, still they need or
> want to
> mess up with how things look like, and they really don't like the idea of
> having to wait two laboral days to change the fricking color of a link, or
> have an newsletter email typo corrected. They need templates, they love
> templates. Just put it in dreamweaver (or the like), fix the look, upload
> and we're back on business, why the hell should I have to call the damn
> coder?

The problems that you outlined above have nothing to do with the
template language used, more about the structure of the site and the
level of control given to the content developers.  Having a simple
content specific file which the content developer can change directly is
a basic must.

Having that file contain smarty template magic or straight php template
magic is a far less important question, why bother with smarty when php
will work just as well?

The biggest issue I see with using php as a template language is that
too much control is given to the content developers.  You don't want
some smartarse throwing complex code around, hacking or opening holes in
your security or creating nasty bugs.

> 
> [sniped pointless flame]

BTW: My prefered template varient of the above loop.

<dl>
 <? foreach ($menu_items as $name => $link): ?>
   <dt> <?=$name?> </dt> <dd> <?=$link?> </dd>
 <? endforeach; ?>
</dl>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux