|
Hi,
I have a route that works on my windows dev machine (php5.3) yet on our server (linux php5.2) it fails with the error 'Cannot assemble. Too few arguments?' Here is the route: routes.ppt.type = "Zend_Controller_Router_Route_Regex" routes.ppt.route = "([a-z-/]*)/-p/(.*)" routes.ppt.defaults.module = "default" routes.ppt.defaults.controller = "search" routes.ppt.defaults.action = "ppt" routes.ppt.map.1 = 'loc' ; regex match 1 is pushed into this variable routes.ppt.map.2 = 'ppt' ; regex match 2 is pushed into this variable routes.ppt.reverse = "%s/-p/%s" it looks for an SEO URL which has a bunch of key phrases in it: http://example.com/clever/seo/words/here/-p/id when I construct the route: echo $this->view->url(array( 'controller' => 'search', 'action' => 'ppt', 'ppt' => '45', 'loc' => 'clever/seo/words/here' ), 'ppt', true, false // <-- don't escape the /s ); Any ideas? monk.e.boy |
|
Hi,
for me worked perfectly, but I used the resource router in application.ini ( did you? ) and also you dont need to repeat the default module/controller/action in the view helper application.ini resources.router.routes.ppt.type = "Zend_Controller_Router_Route_Regex" resources.router.routes.ppt.route = "([a-z-/]*)/-p/(.*)" resources.router.routes.ppt.defaults.module = "default" resources.router.routes.ppt.defaults.controller = "search" resources.router.routes.ppt.defaults.action = "ppt" resources.router.routes.ppt.map.1 = 'loc'; resources.router.routes.ppt.map.2 = 'ppt'; resources.router.routes.ppt.reverse = "%s/-p/%s" In a view script <?php echo "<a href='" . $this->url( array( 'ppt' => 10, 'loc' => 'clever/seo/words/here' ), 'ppt', true, false ) . "' >link";?> Hope this help Bye |
|
Thank you for the reply :)
After some google fu I found : http://files.zend.com/help/Zend-Framework/zend.controller.router.html which says: routes.archive.type = "Zend_Controller_Router_Route_Regex" routes.archive.route = "archive/(\d+)" routes.archive.defaults.controller = "archive" routes.archive.defaults.action = "show" routes.archive.map.1 = "year" ; OR: routes.archive.map.year = 1 so on a whim I tried the other way of defining the route regex map: routes.ppt.type = "Zend_Controller_Router_Route_Regex" routes.ppt.route = "([a-z-/]*)/-p/(.*)" routes.ppt.defaults.module = "default" routes.ppt.defaults.controller = "search" routes.ppt.defaults.action = "ppt" ; ; routes.ppt.map.loc = 1 ; regex match 1 is pushed into this variable routes.ppt.map.ppt = 2 ; regex match 2 is pushed into this variable ; ; routes.ppt.reverse = "%s/-p/%s" and now it works on both servers. Something weird is happening in Zend_Controller_Router_Route_Regex :: _getMappedValues for the first example. I have no idea how to write a coherent bug report for this...? Maybe the $_map is not being populated correctly? I don't have a debugger set up on the remote server so I can't check. monk.e.boy |
|
Administrator
|
-- monk.e.boy <[hidden email]> wrote
(on Wednesday, 20 July 2011, 07:56 AM -0700): > routes.ppt.map.loc = 1 ; regex match 1 is pushed > into this variable > routes.ppt.map.ppt = 2 ; regex match 2 is pushed > into this variable > ; > ; > routes.ppt.reverse = "%s/-p/%s" > > and now it works on both servers. > > Something weird is happening in > > Zend_Controller_Router_Route_Regex :: _getMappedValues > > for the first example. I have no idea how to write a coherent bug report for > this...? Maybe the $_map is not being populated correctly? I don't have a > debugger set up on the remote server so I can't check. From following the thread, it almost looks like the Windows and Linux implementations of parse_ini_* are differing in how they handle numeric keys. Which versions worked on which architectures? -- Matthew Weier O'Phinney Project Lead | [hidden email] Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: [hidden email] Info: http://framework.zend.com/archives Unsubscribe: [hidden email] |
|
Hello everyone,
I have a small problem while trying to use a route with an optional parameter with an empty default value. My router is configured via an XML file. In my bootstrap, I have the following code: $frontController = Zend_Controller_Front::getInstance(); $frontController->getRouter()->addConfig( new Zend_Config_Xml($routesFile) ); My routes are correctly loaded and everything seems to work fine. Yet, I have a problem when trying to use a route that has a parameter with an empty default value. My route: <account_lost_password type="Zend_Controller_Router_Route"> <route>/lostpassword/:email</route> <defaults> <module>account</module> <controller>connect</controller> <action>lostpassword</action> <email></email> </defaults> </account_lost_password> This doesn't work, I always get an empty email parameter with _request->getParam("email") when going to /lostpassword and to /lostpassword/[hidden email] The following route works as expected: <account_lost_password type="Zend_Controller_Router_Route"> <route>/lostpassword/:email</route> <defaults> <module>account</module> <controller>connect</controller> <action>lostpassword</action> <email>noemail</email> </defaults> </account_lost_password> I get noemail if I go to /lostpassword and I get the correct email if I go to /lostpassword/[hidden email] Any ideas ? Best, Jawad -- List: [hidden email] Info: http://framework.zend.com/archives Unsubscribe: [hidden email] |
|
In reply to this post by weierophinney
routes.ppt.map.1 = 'loc' ; regex match 1 is pushed into this variable
routes.ppt.map.2 = 'ppt' ; regex match 2 is pushed into this variable Works on Windows XP PHP5.3 and ZF 1.11.1. Fails on Linux **PHP5.2** ZF 1.11.11 routes.ppt.map.loc = 1 ; regex match 1 is pushed into this variable routes.ppt.map.ppt = 2 ; regex match 2 is pushed into this variable Works on both. Hope that helps :) monk.e.boy |
|
Administrator
|
-- monk.e.boy <[hidden email]> wrote
(on Thursday, 21 July 2011, 03:39 AM -0700): > routes.ppt.map.1 = 'loc' ; regex match 1 is pushed > into this variable > routes.ppt.map.2 = 'ppt' ; regex match 2 is > pushed into this variable > > Works on Windows XP PHP5.3 and ZF 1.11.1. Fails on Linux **PHP5.2** ZF > 1.11.11 > > routes.ppt.map.loc = 1 ; regex match 1 is pushed > into this variable > routes.ppt.map.ppt = 2 ; regex match 2 is pushed > into this variable > > Works on both. > > Hope that helps :) Slightly -- now I'm not sure if it's an OS or PHP version issue. :) However, knowing that the latter notation works on both, I think the appropriate path forward is to add a note to the documentation indicating that that's the only portable way to write the configuration. Could you open an issue for this and assign me to it, please? -- Matthew Weier O'Phinney Project Lead | [hidden email] Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: [hidden email] Info: http://framework.zend.com/archives Unsubscribe: [hidden email] |
| Powered by Nabble | Edit this page |
