zend-route

Routing based on standard PHP query string

时光总嘲笑我的痴心妄想 提交于 2020-01-13 13:45:33
问题 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'); //

ZF2 route parameters with slash

被刻印的时光 ゝ 提交于 2020-01-13 04:23:28
问题 Is it possible to assemble a route with parameters containing forward slashes? Config: 'someroute' => array( 'type' => 'Zend\Mvc\Router\Http\Segment', 'options' => array( 'route' => 'someroute/:path', 'defaults' => array( 'controller' => 'Controller', 'action' => 'index' ), 'constraints' => array( 'path' => '(.)+' ) ) ) Controller: $path = 'some/subdirectory'; $this->url('someroute', array('path' => $path)); Results in: http://host.name/someroute/some%2Fsubdirectory 回答1: Using rawurldecode()

Zend route regex, optional parameters

跟風遠走 提交于 2020-01-06 03:27:11
问题 I need some help about my routes in Zend (Zend1) ... I need that I can use my route like that : http://mywebsite.com/myfolder/region/job/ http://mywebsite.com/myfolder/region/job/add http://mywebsite.com/myfolder/region/job/add/page http://mywebsite.com/myfolder/region/job/page Parameters add and page are optional ... This is what I did $route = new Zend_Controller_Router_Route_Regex( 'myfolder/([^/]+)/([^/]+)/?([^/]+)?/?([0-9]+)?', array('controller' => 'myfolder','action' => 'search'),

Translating route segments with ZF's gettext adapter

限于喜欢 提交于 2020-01-04 14:11:08
问题 I want to try out the route translations in Zend Framework, but I'm using the gettext adapter and the most tutorials have PHP translate adapter, so I'm having problems to make it work. In the main Bootstrap.php I have the method in which I set the routes: $front = Zend_Controller_Front::getInstance(); $router = $front->getRouter(); $translator = Zend_Registry::get('Zend_Translate'); Zend_Controller_Router_Route::setDefaultTranslator($translator); $routerRoute = new Zend_Controller_Router

Translating route segments with ZF's gettext adapter

﹥>﹥吖頭↗ 提交于 2020-01-04 14:10:02
问题 I want to try out the route translations in Zend Framework, but I'm using the gettext adapter and the most tutorials have PHP translate adapter, so I'm having problems to make it work. In the main Bootstrap.php I have the method in which I set the routes: $front = Zend_Controller_Front::getInstance(); $router = $front->getRouter(); $translator = Zend_Registry::get('Zend_Translate'); Zend_Controller_Router_Route::setDefaultTranslator($translator); $routerRoute = new Zend_Controller_Router

Zend Route Catch all

安稳与你 提交于 2020-01-04 11:03:55
问题 Please help! I am a newbie to Zend and want to modifiy the default routing for a cms project I am working on. How do I create a "catch all" route in zend should a controller not exist? I am trying to create links like: mydomain.com/slug mydomain.com/slug1 Where slug and slug1 can be passed as params to a specified default controller (pagesController) so I can fetch the appropriate content from the DB. I apprecaite any help!! :) 回答1: One way to do it is to write a simple Controller Plugin that

Zend Route Catch all

▼魔方 西西 提交于 2020-01-04 11:03:41
问题 Please help! I am a newbie to Zend and want to modifiy the default routing for a cms project I am working on. How do I create a "catch all" route in zend should a controller not exist? I am trying to create links like: mydomain.com/slug mydomain.com/slug1 Where slug and slug1 can be passed as params to a specified default controller (pagesController) so I can fetch the appropriate content from the DB. I apprecaite any help!! :) 回答1: One way to do it is to write a simple Controller Plugin that

Matching Multiple URLs with parameters using Zend_Controller_Router_Route_Regex in Zend Framework

故事扮演 提交于 2020-01-01 02:48:31
问题 i am developing a Rest Controller with Zend and i am confused with the mapping of urls to the Router. Basically i read about Zend Router and i could not plan my urls in order to satisfy the mentioned routes. These are some of my urls that should be mapped to Routers. http://localhost/api/v1/tags.xml http://localhost/api/v1/tags.xml?abc=true (param: abc=true) http://localhost/api/v1/tags/123456.xml (param: 123456.xml) http://localhost/api/v1/tags/123456/pings.xml (params: 123456, pings.xml)

How to set up Hierarchical Zend Rest Routes?

↘锁芯ラ 提交于 2019-12-29 03:33:36
问题 With the Zend Framework, I am trying to build routes for a REST api on resources organized in the following pattern: http://example.org/users/ http://example.org/users/234 http://example.org/users/234/items http://example.org/users/234/items/34 How do I set up this with Zend_Rest_Route? Here is how I have setup the route for the users resource (users/:id) in my bootstrap.php file: $this->bootstrap('frontController'); $frontController = Zend_Controller_Front::getInstance(); $restRoute = new

Route mit special characters are not parsed correctly in Zend Framework 2

假装没事ソ 提交于 2019-12-29 01:24:09
问题 URIs with german special characters don't work (error 404). I've already had this problem (here) and it has been resolved with the unicode modifier and a custom view helper, that uses it. Now I have the same issue with a Segment child route, but this time the approach with the unicode identifier and a custom view helper isn't working. Alle requests like sld.tld/sport/sportäöüÄÖÜß/cityäöüÄÖÜß or sld.tld/sport/sportäöüÄÖÜß/cityäöüÄÖÜß/page/123 are ending with a 404 error. /module/Catalog/config