Zend framework module, controller, action specific routes -
in zend framework application, have routes , defaults like:
resources.router.routes.plain.defaults.module = "index" resources.router.routes.plain.defaults.controller = "index" resources.router.routes.plain.defaults.action = "index" i want able change default routes module or controller or action e.g.
let's assume module/controller/action structure:
content --- article --- read --- write --- news --- list --- write user --- auth --- signin --- signout --- access --- check --- update in architecture,
for module=content want controller=article default controller , action=read default action.
if controller=news chosen action=list becomes default action
for module= user want controller=auth default controller , action=signin default action. if controller=access chosen action=check becomes default action.
so possible in application.ini? , how example?
thanks in advance.
random thoughts:
you define route each module points specific actions defaults.
resources.router.routes.user.route = "user/:controller/:action/*" resources.router.routes.user.defaults.module = "user" resources.router.routes.user.defaults.controller = "auth" resources.router.routes.user.defaults.action = "signin" you define module_indexcontroller::predispatch() or user_accesscontroller::indexaction() uses _forward send request proper "default":
// delaing redirect in predispatch // affect requests controller class user_indexcontroller extends zend_controller_action { public function predispatch() { // send default location user module: $this->_forward('signin', 'auth') } } // dealing redirect in indexaction: // affect requests go "index" action class user_accesscontroller extends zend_controller_action { public function indexaction() { // send default location user module: $this->_forward('check') } } from zend framework documentation - controller utility methods
_forward($action, $controller = null, $module = null, array $params = null): perform action. if called inpredispatch(), requested action skipped in favor of new one. otherwise, after current action processed, action requested in_forward()executed.
Comments
Post a Comment