vimal1083
vimal1083

Reputation: 8661

In zf2 how to load more than one action in controller in a page

How to show both of my Signin and Signup module in a same page,both work fine seperately in their route

www.mydomain.com/Signin

www.mydomain.com/SignUp

How it is possible to include/call signup action while in Signin Action ?

Is there any website in LIVE that had been done in ZF2 ?

Can i get any sample project of Zf2 except ZendSkeltonApplication (It doesn't have two actions in a same page) ?

Upvotes: 0

Views: 274

Answers (1)

Ivan Zmerzlyi
Ivan Zmerzlyi

Reputation: 171

Try use like this, action in your controller

public function loginAction()
{
    $signin = $this->forward()
                    ->dispatch('App\Controller\Signin');        

    $signup = $this->forward()
                    ->dispatch('App\Controller\Signup');

    $page = new ViewModel();

    $page->addChild($signin, 'signinBlock');
    $page->addChild($signup, 'signupBlock');
    return $page;
}

in your view

<?php echo $this->signinBlock ?>
<?php echo $this->signupBlock ?>

Upvotes: 2

Related Questions