[FLOW3-general] Same variable in every template

Martin Lipp martin.lipp at gmail.com
Mon Feb 27 17:17:48 CET 2012


Hi,

i tried this, but assigning variables to templates from the 
initializeAction() seems not to work. I get a blank page (but no errors, 
I'm in dev context) as soon as i add a simple 
$this->view->assign('test', 3); to any initializeAction().

Martin

On 27.02.12 16:37, "Christian Müller (FLOW3 Team)" wrote:
> Hi Martin,
>
> what about the initializeAction() method? You can assign to the view
> there and you could even create an abstract BaseController and put it
> there then extend all your controllers from that so in fact you have to
> set it only once.
>
> Cheers,
> Christian
>
> On 27/02/12 16:19, Martin Lipp wrote:
>> I would like to assign the same variable in every action and all
>> available controllers in order to output it in the layout (all templates
>> share the same layout). Is there an easy way/a best practice to do this,
>> without having to assign it in every single action, which seems to
>> redundant? I've thought of an ViewHelper which returns me the variable,
>> but I'm not sure, if it's a good practice to add repository functions to
>> a ViewHelper.
>>
>> Thanks,
>> Martin
>



More information about the FLOW3-general mailing list