noreo
(Aurelien)
1
I am trying to change a view of one of my widgets via my theme
my widget is called UserThumbWidget, its default views are under: components/widgets/views/UserThumbWidget/aview.php
therefore, I did: themes/mytheme/views/UserThumbWidget/aview.php
I have the following error:
UserThumbWidget cannot find the view "UserThumbWidget/aview".
I call my widget like this:
$this->widget('UserThumbWidget', array(
'userId' => $model->job->user_client_id,
));
Doesn’t anyone have an idea? I guess I am missing something…
jacmoe
(Jacob Moena)
2
Try adding a [color=#1C2837][size=2]UserThumbWidget directory:[/size][/color]
themes/mytheme/views/UserThumbWidget/UserThumbWidget/aview.php
Or change your widget render to code to render ‘aview’ instead.
noreo
(Aurelien)
3
yes, your first solution worked!
However, I don’t really understand why it needed an extra directory…
thanks a lot, jacmoe!
jacmoe
(Jacob Moena)
4
That’s because themed views for widgets is put in a widget-named directory in themes/my_theme/views.
That would normally be themes/mytheme/views/UserThumbWidget/aview.php
However, since you have chosen to put the view for the widget into it’s own directory, you need to put the view into a directory of the same name.
Or put differently:
For normal non-themed widgets, their views are in a directory called ‘views’ in the widget directory.
In your case:
protected/widgets/views/aview.php
or
protected/extensions/views/aview.php
Since you’ve added an extra directory, you need to add that extra directory as well.
I sincerely hope I didn’t confuse the heck out of you now.