4

I want to use a URL like this:

site.com/car-list/param1/value1/param2/value2

"car" is variable and can be anytihng. i solved the "site.com/car-list" part like this:

    $categoryRoute = new Zend_Controller_Router_Route_Regex(
        '(\b.+\-list\b)',
        array(
            'module' => 'default',
            'controller' => 'search',
            'action' => 'index'
        ),
        array(
            1 => 'productType'
        )
    );

I can get "car-list" when i want "productType" param. But i cant get rest of the url with $this->_getParam() in controller.

how can i do this? thanks.

1 Answer 1

5

Well, i don't see how to make it with Router_Route_Regex, but with Router_Route it would be easier (thought, i replace "-" with "/")

$categoryRoute = new Zend_Controller_Router_Route
    ':car/list/*',
    array(
        'module' => 'default',
        'controller' => 'search',
        'action' => 'index'
    )
);

magic happens due to the "/*" at the end of the string. :car variable can be got with $request->getParam('car');

Sign up to request clarification or add additional context in comments.

1 Comment

i think i have to accept this because i already wasted 3 hours with Regex. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.