B
B
bahek24627742014-01-18 02:15:38
Zend Framework
bahek2462774, 2014-01-18 02:15:38

How to output information from another module to the general layout in ZF2?

Help to understand the logic of ZF2.
For authorization I use the ZfcUser module.
Using the UserController controller plugin, in my indexController I display the username if he is identified, or the menu for login or registration if he is not identified.
But, if, for example, go to url /user/login, then the request goes to the zfcUser module in the UserController controller, so I don’t see this block with information (neither the username, nor the login menu, etc.) The
question is:
1) How Should I display information from another module in the general layout?
(for example, within the same module in the controller, you can call $this->forward()->dispatch() )
2) How to add an action in some module - which will be executed at the end. For example, after working out the module, add a variable to the layout with information.
I hope I made my question clear.
I really need help in mastering this difficult framework.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
cawakharkov, 2014-01-18
@bahek2462774

zfcUser has view helpers for this (viewHelper), look at the wiki on github
, and if you don’t take into account zfcUser to display something in a view or layout, it’s better to write your own view helpers, or for example, in the module class (Module.php) learn the layout object and assign it a variable

C
cawakharkov, 2014-01-18
@cawakharkov

here is what you need https://github.com/ZF-Commons/ZfcUser/wiki/How-to-... section View

Y
yvm, 2014-07-15
@yvm

For the second question...
In the controller:
In the layout:
<?= $foo ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question