Basically, I'd like to define a MVC layout in Sitecore, and have that layout be linked to both a controller and a razor file. Currently there are only options to set the Razor file, not the controller.
Goal: have the controller on the layout, set the properties that define the header and footer links. The properties are passed through to the header/footer renderings Sitecore render or MVC partial. The goal is to only call the controller once to pull the necessary data for the header and footer links, instead of twice, once in the header and footer controllers.
Example:
- HomeController.LayoutActionResult
- Create instance of View Model
- Set ViewModel.Header.Info
- Set ViewModel.Footer.Info
- Return View(/layout/MainLayout, ViewModel)
- Views//ayout/MainLayout.cshtml
- stuff html
- @Html()...(/static/path/to/header, Model.Header)
- more html
- @Html()...(/static/path/to/footer, Model.Footer)
- more html