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?
Page 1 of 1
Own CHtml Methods? best practise for implementing own CHTML'ish methods
#2
Posted 08 February 2010 - 07:10 AM
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.*', ...);
Share this topic:
Page 1 of 1

Help













