I think a stack of actions should be avoided. Check out this article why .
You can use the plugin method, or you can create a ViewHelpers that you call from the layout script. I like the ViewHelpers method because it keeps everything very clear. You know that when you echo from $ this-> mainNaviation (), there is a ViewHelper called MainNavigation.
source share