Recommend me template system

Hi,

I am newbie in Yii and I am looking for a template system for rendering views. What could you recommend me? Which one is the fastest/more used/easy integrated to Yii?

Thanks

PHP itself :)

I just don’t understand why people complicate their work by using template systems.

PHP code in the template isn’t very readable, lot of time make the view file bigger than with using a template system. That’s why I am asking.

Yii ships support for PRADO templates by default. There’s a selection of other renderers, too. Among them is one tying in Smarty. Perhaps that’s what you are looking for?

could you any recommend me?

Well, I could recommend my very own, spanking new template system :lol:

Jokes aside: I think you’ll be fine with Smarty. The other options are mostly compatible with Smarty’s syntax, so you’ll lose little should you choose to migrate.

Twig is a nice template system, I think it really can make views more readable :) Though, you will need to spend some time to figure out how to render widgets and other stuff in a nice way. If you are using yii widgets extensively, I don’t think you will gain much benefit, especially taking into consideration new PHP 5.4 array syntax…

If I have to use a template engine other than php I would probably learn twig as it is used by symfony and inspired by pythons django

but I dont have to

I’ve never really seen any real significant reason to adopt a template engine in a framework like Yii over it’s native rendering of views. I keep hearing the argument that it’s good practice to separate your PHP code from your frontend HTML/JS/CSS code, which is fine in theory, but you’re left with having to use the engine’s markup in place of PHP to perform your iterations and comparisons, etc., which render the entire process moot (and also means whoever comes on to the project needs to be familiar with that specific template engine, rather than PHP).

I personally think you’ll be more than fine if you just adhere to strict coding standards - as much as you can, perform all of your hardcore operations prior to calling the view, so that if a frontend developer does come on board they won’t have to sift through copious amounts of PHP.

@Artificial

+1

Don’t write “+1”, push +1! (a little green plus-button) ;)

Artificial nailed it, he just expanded my thoughts in more lines[+1 from me, using the button of course] :)