This project is read-only.

View override

Topics: General, Writing modules, Writing themes
Mar 8, 2011 at 3:51 PM


I've written a controller to override Orchard.Search, I'm wanting to use the exisiting views. I can achieve this with the following from my controller:


return View("Search/index", searchViewModel);


If the Orchard.Search view is overridden in a theme I need to use the following:

return View("Orchard.Search/Search/index", searchViewModel);

What i would like to do is have my controller use the Orchard.Search view by default but if the Orchard.Search view is overridden in a theme, then use the theme view.

Any idea on how i might be able to do this? I assume in the theme engine there must be a find view method i might be able to use to get the path...

Mar 8, 2011 at 7:22 PM

Mmmh, you shouldn't have to do anything further than indicate the name of the default view. If your controller is themed, the theme engine will just replace it with the best it has.