If I already know HTML, why should I learn a new syntax for a class that just creates HTML? I can just type the HTML directly.
I suppose the reason I ask is that I’m making changes to a Yii website developed by somebody else, and sometimes I encounter CHtml functions to create HTML, whereas elsewhere it’s just plain old HTML. When use one and when the other?
Others here are more qualified to answer this than I am. I personally use CHtml mainly for links and images. This might not come up for most people, but I was well into creating my site before I employed the url manager in the config file. If I had <a href=“index.php?r=action/controller”>Link Text</a> for every link I would have had to go to each one and change it to <a href="index.php/action/controller>Link Text</a>. Not a huge advantage, but I’m glad I didn’t have to change all that code.