You have a controller inside a module - defaultController, in which there is this action - actionIndex, this action renders the view which resides in views/default/index.php, thus the folder structure looks like :
But that seemed not working since Yii seems to be looking for anotherView in module1/views/default/anotherView.php
One solution seems to be using the widget, that is, to be specific, to move module2/views/.../anotherView.php into application/components/views/anotherView.php and then declare a widget in application/components/AnotherView.php and then use it in index.php as :
I don’t want to sound too discouraging, but in my opinion, this problem evolves from bad design. It should never be necessary to render a view from another module as a module should be self contained. This is IMHO, of course.
If you can solve it with a widget, that’s much cleaner.
@Mike: Thanks for pointing it out. Actually I had the similar feeling. I came from the symfony world, there the views can render any other partials from arbitrary locations. In symfony "components" are defined as self-contain parts which maps to widgets in Yii, still I think it provides more flexibility if Yii can support arbitrary view rendering, especially during the prototyping phase of a project, you may not want to convert everything into widgets.
Just for the record: I didn’t say, it’s not possible, i just never thought about wether and how to do it. So if you still need it, do some research on the forum here, i think this question already came up several times.