[fw-core] redirector helper and Zend_Controller_Router_Route_Regex route

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[fw-core] redirector helper and Zend_Controller_Router_Route_Regex route

Maciej Homziuk
Hello,

I'm using following router for articles on our page:

        $route = new Zend_Controller_Router_Route_Regex(
            'pressespiegel/(.{0,300})\-ps_([0-9]{1,100})\.html$',
            array(
                'module'     => 'default',
                'controller' => 'pressespiegel',
                'action'     => 'show'
            ),
            array(
                1 => 'title',
                2 => 'id'
            ),
            'pressespiegel/%s-ps_%d.html'
        );

So far everything works great, here is some example url:

http://localhost/pressespiegel/Schluss-mit-dem-Dokumentenchaos-bei-der-r%C3%BCckgedeckten-Unterst%C3%BCtzungskasse-ps_24709.html

In my controller, that is responsible for displaying the article, I
check if the entered url correspondents with the proper url of the
article to avoid this:

http://localhost/pressespiegel/some-dirty-words-ps_24709.html

showing an article. If the entered url doesn't contain the original
title, I try to redirect on the same page with right title of the
article in the url using redirector helper:

            $this->_helper->redirector->goToRoute(
                array(),
                'pressespiegel-talking'
            );

Unfortunatelly the browser says: The page isn't redirecting properly

But when I remove the dot from the reverse pattern in the route, like this:

'pressespiegel/%s-ps_%d'

The result of redirecting is this url:

http://localhost/pressespiegel/Schluss-mit-dem-Dokumentenchaos-bei-der-r%C3%BCckgedeckten-Unterst%C3%BCtzungskasse-ps_24709

which of course produces an error, because it can't be recognised by my
"pressespiegel-talking" route.

Looking at some examples on some pages I didn't found any necessity of
escaping the dot or doing something else with it in the reverse pattern.

Has any one any idea what am I doing wrong?

Thanks and regards
Maciej



--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]