using smarty as view

hi all

i am just want use smarty(template engine) as view in yii framework

i follow many links here

no one prefect no one back me a result

i need explain in details

thank u a lot

Why would you want to use Smarty??? :blink:

simply i don’t like to write php code in view and i like to write less

look this example




<div>

<?php

foreach($arr as $key=>$value){

    echo "<li>".$key." : ".$value."</li>";

}

?>

</div>



same code in smarty




<div>

{foreach from=$arr key=$k item=$v}

     <li>{$k} : {$v}</li>

{/foreach}

</div>



i hope to know the different now

http://www.yiiframework.com/extension/smarty-view-renderer

thanks

i c it before

it’s not working

i am sorry

Sure, I know the difference. Put 50 identical drop menus on a page with a data list of lets say 200 items dynamically generated from a database and see how long it takes to render using Smarty, as opposed to just doing it with PHP (which IS a template engine by the way).

Sorry for this long term reply, but can you name the difference in performance in percent?

I’m completely new to Yii, but know other MVC Frameworks and the only thing disturbing me, is that PHP-spaghetti-coding in the views. It’s against that strict breakup between logic and presentation.