开发者

Zend Navigation, how can i use it with params in the url ? I tried it with params in navigation without changes :(

I have got a problem with the zend navigation. I use the zend navigation, and its ok when i call something like this in the url:

www.website/article_new, www.website/article_list, 
www.website/friends_new, ...

But I want to call the site with some params like this:

www.website/article_new/123452/2335/45633246, 
www.website/friends_new/23453/3453524/34554

I try it about to set some params, but this doesnt function.

I put the navigation in the bootstrap and in the layout I use it. Its a Navigation with some breadcumps where display:true and display:false. Here is a code from my bootstrap:

$navigation = new Zend_Navigation(array(
                                    array(
                                        'label' => 'Home',
                                        'controller' => 'index',
                                        'action' => 'index',
                                        'class' => 'menuF'
                                    ),
                                    array(
                                        'label' => 'Article',
                                        'controller' => 'Article_List',
                                        'id' => 'article',
                                        'act开发者_运维知识库ion' => 'index',
                                        'class' => 'menu',
                                        'pages' => array(
                                            array(
                                            'label' => 'Neu',
                                            'id' => 'article',
                                            'controller' => 'Article_New',
                                            'action' => 'index',
                                            'class' => 'submenu'
                                            )
                                        )
                                    ).....

And the code from the layout.phtml. On this code I show if the breadcump is shown or not.

foreach($container as $page) {
                    $par = $active;
                    if ($page != $active && $page->getClass()!='menu' && $page->getClass()!='menuF' && $page->getID()!=$par->getID()) {
                        $page->setClass('submenu');

                    } else {
                        $found = $container->findAllBy('ID', $active->getID());
                        foreach($found AS $p){
                            if($p->getClass()!='menu'&&$p->getClass()!='menuF'){
                                $p->setClass('sub');
                            }
                        }
                    }
                }
                echo $this->navigation()->menu()->renderMenu($this->nav);

Hope anybody can help me! Thanks for all! Best regards Tom


I found myself the mistake!

I want to call something like this: www.website/article/344435/23452345

surely this throws a mistake, because there isnt any action like 344435

with something like this www.website/article/show/var1/2435234/var2/2345234352 its ok.

the rest is something for routing!

Big sorry to all! Greats Tom


Try to use the route name instead of the module, controler and action system.

array(
 'label' => 'Article',
 'route' => 'Article_List',
 'id' => 'article',
 'class' => 'menu',
 ...
)

The router will handle all the URL parsing and return the correct variables.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜