Why arent you using a regex route?
wjzfw wrote:
While this is another viable possibility, surely there is a way to do this as
I originally intended using a regular expression-based custom route which
would gobble up the entire string following a defined controller and action?
I believe my original approach is correct, perhaps it's just a matter of
syntax?
j
Hector Virgen wrote:
You can use a query parameter to use slashes without the need to encode
them:
/controller/action?myvar=/foo/bar
In your controller you can access it like a route param:
$myvar = $this->_request->getParam('myvar');
It's not as pretty as it would be without the ? but it's a lot prettier
than
using base64 or dashes.
--
Hector
On Mon, Dec 28, 2009 at 8:02 PM, wjzfw <[email protected]> wrote:
Because it would look ugly, not to mention detract from the user's
ability
to
refer to the URL as a navigational aid. Long story short the parameter in
question represents the user's current location within a directory-based
project.
I could modify the path's URL representation to look like
this-is-my-path,
but slashes would be a more realistic representation of one's position
within a file directory.
j
ryan.horn wrote:
Any reason you cannot just urlencode the parameter name to avoid the
complexity?
wjzfw wrote:
Hi,
I'm working on an application which would needs to process a route
which
consists of a parameter containing an unknown number of slashes. For
instance, consider the following URL:
http://www.example.com/controller/action/this/is/my/parameter
In this example, "controller" is the controller, "action" is the
action,
and "this/is/my/parameter" is the parameter. I'm quite familiar with
custom routes, however all attempts to process such a route have
failed.
For instance I've tried this:
$route = new Zend_Controller_Router_Route(
'/process/path/:%s',
array(
'controller' => 'process',
'action' => 'path'
),
array (
1 => 'path'
)
);
$router->addRoute('process', $route);
Apparently %s doesn't work if slashes are included in the parameter.
Can
somebody shed some light on this problem?
Thanks!
j
--
View this message in context:
http://n4.nabble.com/Custom-routes-regular-expressions-and-slashes-tp990107p990123.html
Sent from the Zend Framework mailing list archive at Nabble.com.