How to share one view between two or more controllers? In simple way, if I call render (or renderPartial) function it searches for given template in directory of current controller’s views. How to render other controller’s view? Or maybe I could place common views in some other directory?
I know I can achieve this making that common view to be a widget and then run it in many views of many controllers, but I think it’s a little abuse, when the common view has no logic, only static content.
Ok, I think I understand The path ‘apartment/_searchForm’ searches for view in apartment subdirectory of the current controller’s view directory, while ‘/apartment/_searchForm’ searches for view starting from base view dir.
Maybe is better to create a widget that render this view.
I always use this approach because I like breadcrumbs, so i often have view that are really similar except breadcrumbs and menu. In such cases is really confortable to create a widget for the shared part and write 2 views.
The only diffrence is that instead of call renderPartial I call new widget.