Search code examples
zend-frameworkzend-route

Zend Route overwrites all the urls exist in current page


I am using Zend Router in my project and the rule is like this;

<projects type="Zend_Controller_Router_Route_Regex">
            <route>project/(\d+)/(.+)</route>
            <defaults>
                <controller>project</controller>
                <action>view</action>
            </defaults>
            <map>
                <projectid>1</projectid>
            </map>
            <reverse>project/%d/%s</reverse>
        </projects>

When i go below url;

http://mydomain/project/1/project_name

All the urls exist on this page are replaced with above url.For example, there is a link in this page for sending message to project owner.When i hover on that link, i see that url is as defined above.Message sending url is created like this;

<a href="<?=$this->baseUrl()?>/misc/sendmessage">Send Message</a>

As you can see above, i am using url helper and the content of baseUrl is simply gets keyword called "baseUrl" from appliation.ini file.

Have you ever faced a problem like this?

Thanks in advance

KR Hüseyin


Solution

  • I added "<route>default</route>" to all pages in navigation.This default route must be added to navigation xml for each page.The problem is fixed

    Current navigation.xml:

    ......
    <settings>
       <label>Settings</label>
       <title>Settings</title>
       <resource>edit</resource>
       <privilege>edit</privilege>
       <controller>experts</controller>
       <action>edit</action>
    </settings>
    ......
    

    Updated navigation xml:

    ......
    <settings>
       <label>Settings</label>
       <title>Settings</title>
       <resource>edit</resource>
       <privilege>edit</privilege>
       <controller>experts</controller>
       <action>edit</action>
       <route>default</route>
    </settings>
    ......
    

    Thanks