03-18-2009, 07:19 AM
|
#18 (permalink)
|
|
The Wanderer
Join Date: Dec 2008
Location: Russia, Moscow
Posts: 14
Thanks: 0
|
Quote:
Originally Posted by hello-world
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; ?>
|
|
|
|