tags:

views:

123

answers:

1

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.

A: 

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.

Tom
This is exactly what I was looking for. The Jobeet book also outlines a [similar solution](http://www.symfony-project.org/jobeet/1_4/Doctrine/en/19#chapter_19_language_switching).
gruner