php - Call view script of (parent) Abstract controller Zend -


i have parent (abstract) controller, have 2 child controllers extending abstract controller. have action common in both child controllers, hence implemented in abstract controller.

the problem when call action 1 of child controllers (e.g. /module/child1/commonaction), action call pass through base controller , after executing functionality, looks view script. have common view script under folder name same of base controller, underlying zend mechanism looks view script in directory named after child controller (in case looks child1/commonaction.phtml) though have view script in basecontroller/commonaction.phtml.

how can render view script under base controller directory?

the easiest way within action disable default viewrenderer , render file yourself.

// coerce view view renderer. $viewrenderer = zend_controller_action_helperbroker::getstatichelper('viewrenderer'); $viewrenderer->initview("/path/to/base/controller"); $this->view = $viewrenderer->view; // disable automatic rendering $viewrenderer->setnorender(true); // action stuff here $this->getresponse()->appendbody($this->view->render("viewscript.phtml"); 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -