Thread: Template Engine
View Single Post
Old 03-18-2009, 07:19 AM   #18 (permalink)
triumvirat
The Wanderer
 
triumvirat's Avatar
 
Join Date: Dec 2008
Location: Russia, Moscow
Posts: 14
Thanks: 0
triumvirat is on a distinguished road
Default

Quote:
Originally Posted by hello-world View Post
Well for it smarty makes code readable for designers.
I do not agree.

If the designer is not an idiot, then he will not understand the complexity and the "strict" syntax of PHP.


What is the difference between the following structures for a designer?

Smarty:
PHP Code:
{include file=$includeFile
PHP:
PHP Code:
<? include($includeFile);
Smarty:
PHP Code:
<select name="company">
  {
html_options options=$vals selected=$selected_id}
</
select
PHP:
PHP Code:
<select name="company">
<? foreach($company as $option): ?>
<option value="<?=$option['value']?>"><?=$option['text']?></option> 
<? endforeach; ?>
Smarty:
PHP Code:
{if $name eq 'Fred'}
    
Welcome Sir.
{elseif 
$name eq 'Wilma'}
    
Welcome Ma'am.
{else}
    Welcome, whatever you are.
{/if} 
PHP:
PHP Code:
<? if ($name == 'Fred'): ?>
    Welcome Sir.
<? elseif($name == 'Wilma'): ?>
    Welcome Ma'am.
<? else: ?>
    Welcome, whatever you are.
<? endif; ?>
triumvirat is offline  
Reply With Quote