[FLOW3-general] Making variables available for the Layout

Daniel Dornhardt - Daniel Dornhardt Development daniel at dornhardt.com
Wed Oct 31 19:28:43 CET 2012


Also you could use a simple viewhelper maybe?

Like this:

http://pastebin.com/0Atc2EdX

?

Best wishes

Daniel

On Wed, Oct 31, 2012 at 6:33 PM, Pankaj Lele <pankaj at lelesys.com> wrote:

> Hi François,
>
>
> > In my Flow application (actually a FLOW3 1.1 app), I have a general
> > layout with some menu bar at the top. This menu bar is templated in the
> > Layout file. Now I would like to display the user's name inside the menu
> > bar. Is there any way to assign a variable (the current account, in this
> > case) early on so that it is available for every controller/action
> > combination rather than having to load in every controller's every
> action?
>
> By default only Settings of the package are available in the Fluid
> template as variable automatically.
>
> The easiest way can be to define a AbstractController and have all your
> controllers extend this. In this AbstractController define method
> initializeAction() and in this method assign the account as variable.
> initializeAction() is called before any action.
>
> Another complex approach can be by using AOP class and crosscutting all
> controller->actions. Then you will get the controller object and you need
> to use the ObjectAccess to use the protected $view property of it as there
> is no public $controller->getView() function available I think.
>
> -Pankaj
>
> --
> Pankaj Lele
> CTO - Lelesys, India
> http://www.lelesys.com
> Twitter: @pankajlele
>
> ______________________________**_________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-**bin/mailman/listinfo/flow3-**general<http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general>
>



-- 
Daniel Dornhardt, Daniel Dornhardt Development
daniel at dornhardt.com
+49 152 - 56 17 22 61


More information about the FLOW3-general mailing list