Hello guys,
i'm wondering how i can manually start execute a controller action of my MVC application. My goal is to integrate the html output of /myController/myAction into another php application (typo3) using a simple include. I thought of manually instantiating the controller, the view and the layout, to bypass the dispatcher. Sadly i can't get it working. My current approach looks like this:
// standard bootstrap ... setting up autoloader, database etc.
$layout = new Zend_Layout();
$layout->setLayoutPath(('/application/default/layouts'));
$layout->setLayout('main');
$layout->setContentKey('content');
$view = new Zend_View();
$controller = new IndexController(new Zend_Controller_Request_Http($currenUrl), new Zend_Controller_Response_Http());
$controller->view = $view;
$controller->init();
$controller->hinweisAction();
$layout->content = $view->render();
echo $layout->render();
Instantiating the layout is no problem, but it becomes complicated when creating the controller. Setting the view instance after calling the constructor does not work, because the view is needed already during the instantiation.
What would be the "right" way for such a scenario? Maybe implement a simple user defined dispatcher which uses predefined controller and action names from me?
Greets
Georg Wächter