zend-route

Optimizing Zend framework routes

蹲街弑〆低调 提交于 2019-12-06 13:48:25
I'm using a traditional Zend framework application generated using Zend tool . I have several modules in my application all generated using Zend tool too. I'm intending to use the default routes in Zend framework in my application. For example: www.host.com/module/controller/action/param1/value1/param2/value2 Here are my questions: Performance wise, using the default routes is the fastest solution, right? Since I won't ever change the routes, is there a way to make the routing process even faster? caching for example? skipping the routing process entirely? or any other technique? What is the

Zend Framework route: unknown number of params

China☆狼群 提交于 2019-12-06 01:26:51
问题 I'm trying to write a route for an level N category depth. So an usual category URL would look like this: http://website/my-category/my-subcategory/my-subcategory-level3/my-subcategory-level4 It has an unknown depth and my route has to match all possible levels. I made a route for this, but I can't get all the params from my controller. $routeCategory = new Zend_Controller_Router_Route_Regex( '(([a-z0-9-]+)/?){1,}', array( 'module' => 'default', 'controller' => 'index', 'action' => 'index' ),

Routing based on standard PHP query string

折月煮酒 提交于 2019-12-05 22:51:50
As you know, Zend Framework (v1.10) uses routing based on slash separated params, ex. [server]/controllerName/actionName/param1/value1/param2/value2/ Queston is: How to force Zend Framework, to retrive action and controller name using standard PHP query string, in this case: [server]?controller=controllerName&action=actionName&param1=value1&param2=value2 I've tried: protected function _initRequest() { // Ensure the front controller is initialized $this->bootstrap('FrontController'); // Retrieve the front controller from the bootstrap registry $front = $this->getResource('FrontController');

How to add variable at the start of the URL in Zend Framework?

人盡茶涼 提交于 2019-12-05 07:48:23
I am trying here to create url, like: /admin/login /moderator/login both the request would be served by same controller & action made for login, i.e. /account/login/<type> Currently, all I am able to make the following URL: /login/admin /login/moderator My current config file looks like the following: resources.router.routes.login.route = "login/:type" resources.router.routes.login.defaults.controller = "account" resources.router.routes.login.defaults.action = "login" I can't figure out, on how to put the type variable at the start of URL, I tried it but it gives server error. edit I got this

Zend Routes translate URL's

ⅰ亾dé卋堺 提交于 2019-12-04 15:16:21
1) I have a controller "calendar" and have action "showDate" which gets date via url. So, url is something like "calendar/show-date/date/2012-07-22" 2) I have a link to display all entries, "calendar/" So, I want to create routes so my links look like "kalendar/2012-07-22" and "kalendar/". Can anyone help me? According to this post: http://www.z-f.fr/forum/viewtopic.php?id=5138 The solution is to add '@locale' => $lang to the params. $this->url(array('lang'=>'it','@locale'=>'it')) It works very well for me. I've been looking into translating the URL with Zend_Translate and I came across this

Zend Framework route: unknown number of params

大兔子大兔子 提交于 2019-12-04 07:49:11
I'm trying to write a route for an level N category depth. So an usual category URL would look like this: http://website/my-category/my-subcategory/my-subcategory-level3/my-subcategory-level4 It has an unknown depth and my route has to match all possible levels. I made a route for this, but I can't get all the params from my controller. $routeCategory = new Zend_Controller_Router_Route_Regex( '(([a-z0-9-]+)/?){1,}', array( 'module' => 'default', 'controller' => 'index', 'action' => 'index' ), array( 1 => 'path'), '%s' ); $router->addRoute('category', $routeCategory); I can't seem to find a way

How to get Zend Route to use a different module depending on the domain name

帅比萌擦擦* 提交于 2019-12-04 05:29:07
问题 I'd like to set up multiple domain names to use the same framework, but I can't seem to get zend's router to bend to my will. There are plenty of examples using subdomains, but trying to make them work for an entire domain doesn't seem to work as I would expect it to. Here's the closest I've come, but it doesn't seem to work: resources.router.routes.mysite.type = "Zend_Controller_Router_Route_Hostname" resources.router.routes.mysite.route = "www.mysite.com" resources.router.routes.mysite

How to get Zend Route to use a different module depending on the domain name

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 03:14:40
I'd like to set up multiple domain names to use the same framework, but I can't seem to get zend's router to bend to my will. There are plenty of examples using subdomains, but trying to make them work for an entire domain doesn't seem to work as I would expect it to. Here's the closest I've come, but it doesn't seem to work: resources.router.routes.mysite.type = "Zend_Controller_Router_Route_Hostname" resources.router.routes.mysite.route = "www.mysite.com" resources.router.routes.mysite.defaults.module = "mysite" resources.router.routes.mysite1.type = "Zend_Controller_Router_Route_Hostname"

Zend Form SetAction Using Named Routes

与世无争的帅哥 提交于 2019-11-30 08:56:59
I have a form that I am trying to set the action for. I want to declare the action inside my form file (which extends Zend_Form) instead of in a controller or view, using a route I have created in my bootstrap. Usually when I want to use a route I do something like $this->url(array(), 'route-name'); in the view, or $this->_helper->url(array(), 'route-name'); in the controller. How do I call a route from within Zend_Form? edit: I have given up trying to load a route into zend_form. Perhaps in a future release there may be a function to easily do this? I have created a viewScript for my form and

What is 'may_terminate' in zend framework 2?

北战南征 提交于 2019-11-28 20:26:17
I am beginner working with Zend. I have seen may_terminate in module route configuration. I don't understand what it is for. According to ZF2 official docs , the option “may_terminate” hints to the router that no other segments will follow it. Still I don't get the meaning of no other segments will follow it . What is it here? Can anyone please explain it with small example? The may_terminate option will indicate to the router that 'this' route is able to be matched solely on the value of its route ; even when it defines child_routes . Consider the following example route configuration.