Indeed, a regex route would work here. I use a regex route here [
http://code.google.com/p/mz-project/source/browse/trunk/modules/modules/Bootstrap.php]
and it could parse and generate urls with any number of slashes (although I
had to disable escaping to generate urls).

$route = new Zend_Controller_Router_Route_Regex(
    'process/path/(.+)',
    array('module' => 'default', 'controller' => 'process', 'action' =>
'path'),
    array('path' => 1),
    'process/path/%s'
);
would probably work.

   -- Mon


On Tue, Dec 29, 2009 at 12:35 PM, Ant Cunningham <
[email protected]> wrote:

> Well i have something similar working for a "static" page type module where
> the regex route has a single param which is a path just like the OP was
> discussing. I didnt experience any issues with it on Apache 2.2.
>
>
>  I may be wrong, but I don't think a regex route will work either. It has
>> to do with how Apache handles forward slashes, at least from what I
>> remember. In order to use unencoded slashes, I had to use a $_GET parameter.
>>
>> --
>> Hector
>>
>>
>> On Mon, Dec 28, 2009 at 8:16 PM, Ant Cunningham <
>> [email protected] <mailto:[email protected]>>
>> wrote:
>>
>>    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]
>>            <mailto:[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.
>>
>>
>>
>>
>>
>>
>

Reply via email to