Jiew Meng
Jiew Meng

Reputation: 88187

Zend_Navigation menu works but not breadcrumbs

I have configured my zend navigation menu like

Config: http://pastebin.com/B212uWKz

public function _initNavigation() {
  $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav');
  $navigation = new Zend_Navigation($config);

  $this->bootstrap('view');
  $view = $this->getResource('view');
  $view->navigation($navigation);
}

Layout

<!DOCTYPE HTML>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title>Zend Navigation Test</title>
</head>
<body>
  <?php echo $this->navigation()->menu(); ?>
  <hr />
    <?php echo $this->navigation()->breadcrumbs(); ?>
  <hr />
  <?php echo $this->layout()->content; ?>
</body>
</html>

The menu works but not the breadbrumbs. I also tried from here

<?php echo $this->navigation()->breadcrumbs()
                              ->setLinkLast(false)
                              ->setMinDepth(0)
                              ->render(); ?>

Still only the menu works

Upvotes: 1

Views: 1226

Answers (2)

takeshin
takeshin

Reputation: 50638

Maybe they use different containers?
Maybe max depth?

<?php echo $this->navigation()->breadcrumbs()
                   ->setLinkLast(false)
                   ->setMinDepth(0)
                   ->setMaxDepth(500)
                   ->render($this->navigation()->getContainer()); ?>

Upvotes: 1

Marcin
Marcin

Reputation: 238081

Looking at your code I think that the problem might be because you use uri tags rather then controller and action tags. For instance instead of:

    <home>
        <label>Home</label>
        <uri>/</uri>
    </home>

there should be:

    <home>            
        <label>Home</label>
        <controller>index</controller>
        <action>index</action>
    </home>

Hope it will work for you.

Upvotes: 0

Related Questions