Overwrite CHtml


I've read tutorials and search on the site but I did'nt found answers. What the best way to overwrite CHtml methods ? For exemple, if I want to use a controlledLink() method based on link() method but with role controll.

  • I need to creat a MyHtml class, extends CHhtml with a controlledLink() method.  In this case, where I need to call my class ?

  • I could add method to CHml with behaviors or something else. In this case, how ?

Thanks a lot.

You can place your own class in protected/components. And then you can use it directly without including the file explicitly. Here we assume you have imported the protected/components directory (as the testdrive app does).

Thanks !