Studyon Minte9.com
ZF 1.0

Study

Forward



Utility methods

_forward($action, $controller = null, $module = null, array $params = null): perform another action. 
If called in preDispatch(), the currently requested action will be skipped in favor of the new one. 
Otherwise, after the current action is processed, the action requested in _forward() will be executed. 


Application/modules/default/controllers/FrontendController.php
--------------------------------------------------------------
<?php
class FrontendController extends Zend_Controller_Action {

	public function indexAction() {
		$this->view->message = "Hello world";
	}

	public function testForwardAction() {

		$this->_forward('index');
			// display "Hello world"

		$this->_forward('error2', 'error', 'default', array('message'=>'My error message'));
			// display "My error message"
	}	
}


Application/modules/default/controllers/ErrorController.php
--------------------------------------------------------------
<?php
class ErrorController extends Zend_Controller_Action {

	public function error2Action() {
		die($this->_getParam('message'));
	}
}


http://framework.zend.com/manual/en/zend.controller.action.html