I'm using the 'modules' front controller resource for the project setup.
What's the best approach to render site-wide elements, like navigation?
- Add the action which renders the element to the end of the action stack each request?
- is it OK to render these elements through controller actions?
- Create a plugin which renders the element?
- Could I use module specific plugins?
- are there other possible ways to do this?
Best Answer
I think the action stack should be avoided. See this article for why.
The plugin method could work or you can create ViewHelpers which you call from you layout script. I like the ViewHelpers method because it keeps everything very clear. You know that when you echo out $this->mainNaviation() that there is a ViewHelper called MainNavigation.