My problem is that in ZF2 missing Action View Helper.
How can I use for example in layout.phtml (or in other view)?
ZF1: $this->action("index", "index") // call IndexController indexAction
ZF2: ???
How can i solve this?
The problem solved!!! ;)
http://www.michaelgallego.fr/blog/?p=223
First you need to write a custom helper like this:
https://github.com/AlloVince/eva-engine/blob/master/vendor/Eva/View/Helper/Action.php
Maybe you need to change the namespace to fit your project, Then register this helper as a invokable helper service in your module config file:
'view_helpers' => array(
'invokables' => array(
'action' => 'Eva\View\Helper\Action',
),
),
Then you could call any controller action in view like this:
$this->action('Engine\Controller\PagesController', 'indexAction');
EDIT:
OP found a nice solution here: http://www.michaelgallego.fr/blog/?p=223. Since he didn't post it as an answer, other users might miss it.
Action
view helper was not recommended in zf1 and was completely removed in zf2 as bad practice. You should consider changing application design to not rely on such behaviour.