Customizing The Widget View Path.

Hi all,

Is there any way to customize the widget view path in yii. I am able to change the normal view path to my own view path by adding '//view path name/' while rendring the view in controller.

But i cant do same for the widgets-while rendering the widget view file.

For ex suppose if i have a widget named calender in components widget directory and i want to keep the view file for that widget inside the protected/views/sidebar/calender.

I tried with $this->render(’//sidebar/calender’) but it throws error as cannot find the view…

So how can i do this?


There a different solutions:

  1. You can use alias path to render a specific view:


  1. You can implement your own baseclass of CWidget and override the ‘getViewPath()’ method.

    Yii getViewPath

  2. Take a look at Theming widgets (Skins, Themes) too.