2

I'm new to zend framework and its my first question I asked in the internet... sorry for my bad english! I have got a problem and in some hours I would jump out of the window ;) I have one controller A, then I need 4 other controllers (B, C,D,E) to call their models and give the answer to the controller A. Controller A send it after this to the view.

Zend_Framework sadly doesn't allow something like this:

Class Arcticle_SteuerController {
    public function showAction() {
    .....
          $text = new Article_TextController();
          $opt = new Article_OptionController();
          $dates =  new Article_DatesController();

          $varText = $text->showTextAction();
          $varOpt = $opt->showOptAction();

          $this->view->varText;
          $this->view->varOpt;
            ....
    ....
    }
}

I have got a problem to put everything in one Controller, because every Controller has its own model and this is wrong designing I think so. So I want to try to call another function from another class.

I find something, that not every Action needs a view... like this:

$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($this->view)
             ->setNoController(true);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);

The problem is that _forward only call the function after the current function. Can anybody help me? Is there a chance, or do I have to put everything in one Controller?

Hope and thanks for help

Best regards Tom

Benjamin Cremer
  • 4,842
  • 1
  • 24
  • 30
Tomtom33
  • 43
  • 3

1 Answers1

0

ZF isn't designed as an HMVC framework, but you can pull this off. One way might be by using an action stack helper/plugin. Check out the documentation: http://framework.zend.com/manual/en/zend.controller.actionhelpers.html

You should be able to get back html from those controllers' views. I'm not sure how scalable this method is if used overall to simulate an HMVC, however.

lucian303
  • 3,483
  • 1
  • 17
  • 11
  • Thanks for the answer! I heard about that Zend doesnt use the hmvc-concept. That was my big mistake by using the Zend Framework. I think to pull this off, is for my bachelorthesis the wrong way. One part of my thesis is to show how to use the zend framework (mvc). So i pull everything in one controller and its happened :) thanks! best regard tom – Tomtom33 May 09 '11 at 13:16