php - Zend Framework - Redirecting to IndexController in different module -


all,

i have following project setup in zend's mvc framework. upon accessing application, want user redirect "mobile" module instead of going indexcontroller in "default" module. how do that?

-billingsystem -application     -configs         application.ini     -layouts         -scripts             layout.phtml     -modules         -default             -controllers                 indexcontroller.php             -models             -views             bootstrap.php         -mobile             -controllers                 indexcontroller.php             -models             -views             bootstrap.php bootstrap.php -documentation -include -library -logs -public     -design         -css         -images         -js     index.php     .htaccess 

my index.php has following code:

require_once 'zend/application.php'; require_once 'zend/loader.php';   $application = new zend_application(   application_env,   application_path . '/configs/application.ini' );  $application->bootstrap()->run(); 

you have 2 options :

1- set mobile default module application editing application.ini file resources.frontcontroller.defaultmodule = "mobile"

2- can create plugin intercept every request , forward same controller , action mobile module

class name_controller_plugin_mobile extends zend_controller_plugin_abstract {      public function predispatch(zend_controller_request_abstract $request) {                  $module = $request->getmodulename();                 $controller = $request->getcontrollername();                 $action = $request->getactionname();                 if($module !== "mobile" || $module !== "error"){                   return $request->setmodulename("mobile")->setcontrollername("$controller")                     ->setactionname("$action")->setdispatched(true);                   }else{                    return ;                  }     } } 

and don't forget add error controller if clause don't end mysterious loop when application throws error , ,


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -