2

So i have a Zend_Route in my application like this :

public function _initRoutes() {
    $front  = Zend_Controller_Front::getInstance();
    $router = $front->getRouter();
    $route  = new Zend_Controller_Router_Route(':language/:controller/:action/*',
                                                array(
                                                    'language'  => 'de',
                                                    'controller'=> 'index',
                                                    'action'    => 'index'
                                                ),
                                                array(
                                                    'language'  => '[a-z]{2}'
                                                ));

    $router->addRoute('lang_route', $route);
}

and my xml

<?xml version="1.0" encoding="UTF-8" ?>
<configdate>
<nav>
    <home>
        <label>Home</label>
        <controller>index</controller>
        <action>index</action>
        <pages>
            <my_account>
                <label>Galery</label>
                <controller>index</controller>
                <action>list</action>
            </my_account>
        </pages>
    </home>
    <login>
        <label>Login</label>
        <controller>login</controller>
        <action>index</action>
    </login>
</nav>
</configdate>

My problem is, that Zend_Navigation creats wrong urls. So when i enter the url http://localhost/zf/public/en the urls generated by Zend_Navigation still looks like http://localhost/zf/public/de/index/

Hope anyone has some ideas :)

phil
  • 137
  • 12

1 Answers1

1

You have to add the route you want to use for creating the correct URL in your Xml configuration:

<?xml version="1.0" encoding="UTF-8" ?>
<configdate>
<nav>
    <home>
        <label>Home</label>
        <controller>index</controller>
        <action>index</action>
        <route>lang_route</route>
    </home>
</nav>
</configdate>

In the Xml configuration you can use the same keywords as specified for Zend_Navigation_Page_Mvc.

ByteNudger
  • 1,545
  • 5
  • 29
  • 37