Own CHtml Methods?

Hi,

i am using quite a lot of very small methods in my views that repeat themselfes in other views as well.

i.e. presenting the amount of stars for a hotel or formating a number to become a price and so on.

So it would be nice to put them somewhere.

Having a widget, just for presenting a price seems a bit overdoing to me.

The best would be if i could write my own CHtml methods i guess so i could use/access them easily.

What do you think would be the best way to do that?

I don’t think extending CHtml is a good idea in this case. Why not just create a helper class with only static methods, so you can access them: MyHelperClass::stars(5)? You can put your helpers in protected/helpers directory (and don’t forget to set in config: ‘import’ => array(‘application.helpers.*’, …);