symfony: form in the layout?
I have a form I need to show on every page. I'd like to put it in the layout rather than defining it in multiple controllers and view templates. I'm not sure how to do this without creating a slot for it, but then I have to define the slot in 开发者_如何转开发every template, and I'm back at square one.
My other thought would be to create a custom action class that defines the form and then subclass all my other actions from it, but that seems like overkill.
You could just use a component, easier than a slot, and stick that in your template, only needs to be defined in one place:
<?php include_component('someModule', 'someAction') ?>
I use components and partials in my layouts quite a bit, works well.
精彩评论