My intent was to find a way to change the part of the code where the get variables are picked up, so I can do:
$this->getRequest()->getParam('param');
from a url like http://example.com/?param=value
and convert it to http://example.com/param/value
using something like $request_uri = preg_replace("|/(.*)|", "\\1", str_replace("\\", "/", $_SERVER['REQUEST_URI']));
So I would be manipulating the url that comes in and the variable from where the getParam method takes in the get parameters.
What variables would I need to change if I wrote a function in the bootstrap?
-Andy
From: Саша Стаменковић
Sent: Wednesday, March 03, 2010 3:34 AM
To: Bart McLeod
Subject: Re: [fw-mvc] Re: Changing get parameters to controller/action/param/value/param/value
There is another problem with /controller/action?param=value, url helper don't see get parameters, it only see parametersif they are zf style, so param will not be handled by url helper if it is not in zf param style.
People coming up with their own implementations for url helper which handles this, example http://robertbasic.com/blog/myurl-view-helper-for-zend-framework/
Regards,
Saša Stamenković
On Wed, Mar 3, 2010 at 10:03 AM, Bart McLeod <mcleod@spaceweb.nl> wrote:
David Muir schreef:For this, you only need a custom route. No extra rewrite.That would only be necessary if the desired form were actually required. Zend's default router sees them as being equivalent: /controller/action/param/value /controller/action?param=value so in both cases $this->getRequest()->getParam('param'); //returns 'value' However, if you're wanting something like: /search/value
The point in the original post is that for some unknown reason the get url should be consistent with the other urls in the application.
So the question is how can we make /controller/action?param=value appear as /controller/action/param/value
But the more important question, as pointed out by Andreas is "Why?"
then yes, you'll need to do the rewrite server-side.--
Bart McLeod
Space Web
Middenlaan 47
6865 VN Heveadorp
The Netherlands
t +31(0)26 3392952
m 06 51 51 89 71
@ info@spaceweb.nl
www.spaceweb.nlBart McLeod is a Zend Certified Engineer.
没有评论:
发表评论