subcontroller path separator

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

subcontroller path separator

emile1986-2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: subcontroller path separator

David Kanenwisher
Hello,

I'm not positive about this but have you tried changing the path from
':controller/:action' to 'content/page' like so:

               $pathRoute = new Zend_Controller_Router_Route(
                       'content/page',
                       array(
                               'controller' => 'content_page',
                               'action'         => 'index'
                       )
               );

I think this should work but just with the content_page controller.

Regards,

David Kanenwisher

On Wed, Apr 13, 2011 at 4:37 AM, emile1986 <[hidden email]> wrote:

> Hello all,
>
> I have a subcontroller in my cms module named content_page,
> and i have to access the subcontroller with the following url:
> http://cms.mydomain.nl/content_page.
> But what i want is to access the subcontroller like this:
> http://cms.mydomain.nl/content/page because
> i don't like the '_' in the url. I know that i have to create a custom
> route
> for it to achieve that but for some reason it doesn't work for me, here's
> my
> custom route that i have setup in a controller plugin:
>
> My custom route Plugin
> [code]
> <?php
>
> class APP_Controller_Plugin_Routes extends Zend_Controller_Plugin_Abstract
> {
>        protected $_domain = 'mydomain.nl';
>
>        public function routeStartup(Zend_Controller_Request_Abstract
> $request)
>        {
>                $front = Zend_Controller_Front::getInstance();
>                $router = $front->getRouter();
>                $router->removeDefaultRoutes();
>
>                $pathRoute = new Zend_Controller_Router_Route(
>                        ':controller/:action/*',
>                        array(
>                                'controller' => 'content_page',
>                                'action'         => 'index'
>                        )
>                );
>
>                $defaultRoute = new Zend_Controller_Router_Route(
>                        'cms.'.$this->_domain.'/content/page',
>                        array(
>                                'module'         => 'cms'
>                        )
>                );
>
>                $router->addRoute('cms', $defaultRoute->chain($pathRoute));
>        }
> }
> [/code]
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/subcontroller-path-separator-tp3446708p3446708.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: [hidden email]
> Info: http://framework.zend.com/archives
> Unsubscribe: [hidden email]
>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: subcontroller path separator

emile1986-2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: subcontroller path separator

David Kanenwisher
You might need to specify the URI for each element as in example #2 in the
manual page for nav containers:
http://framework.zend.com/manual/en/zend.navigation.containers.html

<http://framework.zend.com/manual/en/zend.navigation.containers.html>
Regards,

David Kanenwisher

On Thu, Apr 14, 2011 at 12:27 PM, emile1986 <[hidden email]> wrote:

> Thank you for your help David,
>
> The url with the / separator works great now, but it also created a new
> problem.
> My Zend_Navigation menu seems to work as it should be, until i click on the
> link to
> my subcontroller. From that point all my zend_navigation menu items points
> to the
> subcontroller!
>
> This is my zend_navigation xml file:
> <?xml version="1.0" encoding="UTF-8"?>
>
>
>
>                        Home
>                        cms
>                        index
>                        index
>
>
>                        Gebruikers
>                        cms
>                        users
>                        index
>
>
>                                        Nieuwe gebruiker
>                                        cms
>                                        users
>                                        new
>
>
>
>
>                        Content
>                        cms
>                        content
>                        index
>
>
>                                        Pagina's
>                                        /content/page
>
>
>
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/subcontroller-path-separator-tp3446708p3450247.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: [hidden email]
> Info: http://framework.zend.com/archives
> Unsubscribe: [hidden email]
>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: subcontroller path separator

Peter Sharp
This post was updated on .
In reply to this post by emile1986-2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: subcontroller path separator

emile1986-2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: subcontroller path separator

David Kanenwisher
Does it make any difference if you append render() to the call posted above
like so:
<?php
echo $this->navigation()->menu()
                                  ->setMaxDepth(10)
                                  ->setMinDepth(1)
                                  ->setOnlyActiveBranch(true)
                                  ->setRenderParents(false)
                                  ->render();
?>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: subcontroller path separator

emile1986-2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: subcontroller path separator

emile1986-2
CONTENTS DELETED
The author has deleted this message.
Loading...