Reputation: 2497
Considering that Chtml means extra processing for server side to convert from php to html, so it impacts performance, how much will the impact be considering a high usage application. Alternatively if we use plain html, is it the better way to go.
Upvotes: 3
Views: 1422
Reputation: 3185
It's easier to maintain. For instance, a drop down box. Say you wanted to change the values. With Chtml it can pull the values from a database which means you could make an "administrative" view for said form. I make these "administrative" views for my applications so a tech can change the form without asking me to change code. If it was html, I'd have to change my hard coded values by hand for something that I shouldn't really be dealing with.
Also, the more complex views you make the more chtml makes sense. For instance, I use CactiveForm which interacts with my Active Record models. It makes validation easier for me to maintain and code in the first place. A tutorial on CActiveForm can be found here.
The performance shouldn't be an issue. The php isn't doing anything fancy. If you turn on debugging in your main index.php file you can actually see how long things take. My views compute in .002 of a second. :)
Good question by the way.
Upvotes: 1