Issues

ZF-9277: extend navigation menu for setSeparator() method

Issue Type: Improvement Created: 2010-02-26T15:23:35.000+0000 Last Updated: 2011-09-06T08:36:04.000+0000 Status: Closed Fix version(s): Reporter: Hans Müller (anno) Assignee: Frank Brückner (frosch) Tags: - Zend_Navigation

  • View_Helper

Related issues: Attachments:

Description

For now it is only possible to use the method "setSeparator()" with breadcrumbs. If somebody wants to use navigaton menu with his own style and the method "setPartial()" is used it is very well to have a possibility to set a separator and use it in the view script.

<pre class="highlight">
$this->navigation()->menu($container)->setSeparator(">>")->setPartial("any_view_script.phtml")->render();

Comments

Posted by Kai Uwe (kaiuwe) on 2011-01-26T00:31:07.000+0000

Hi Hans, a separator is a good idea. But we need two: one for the whole element and one for list items.

<pre class="highlight">
if ($depth > $prevDepth) {
    // ...
    $html .= $myIndent . '

' . self::EOL;
} else if ($prevDepth > $depth) {
    // ...
    for ($i = $prevDepth; $i > $depth; $i--) {
        $ind = $indent . str_repeat('        ', $i);
        $html .= $ind . '    ' . self::EOL;
        $html .= $ind . '' . self::EOL;
    }
    // close previous li tag
    $html .= $myIndent . '    ' . self::EOL;
} else {
    // close previous li tag
    $html .= $myIndent . '    ' . self::EOL;
}


<pre class="highlight">
$separator     = $this->getSeparator();
$listSeparator = $this->getListSeparator();

if ($depth > $prevDepth) {
    // ...
    $html .= $myIndent . '

' . $listSeparator;
} else if ($prevDepth > $depth) {
    // ...
    for ($i = $prevDepth; $i > $depth; $i--) {
        $ind = $indent . str_repeat('        ', $i);
        $html .= $ind . '    ' . $listSeparator;
        $html .= $ind . '' . $separator;
    }
    // close previous li tag
    $html .= $myIndent . '    ' . $listSeparator;
} else {
    // close previous li tag
    $html .= $myIndent . '    ' . $listSeparator;
}

These would be also available in your partial scripts.

Posted by Frank Brückner (frosch) on 2011-09-06T08:24:52.000+0000

The separator is an output as "real" content, which the user can see. The same use as in the breadcrumb helper. For the HTML formatting we should use an option "formatOutput" (look at the sitemap helper).

Posted by Frank Brückner (frosch) on 2011-09-06T08:30:36.000+0000

I do not see why we need a separator for a menu! I think we can close this issue. For formatted output, I'll work on: ZF-8874

Posted by Frank Brückner (frosch) on 2011-09-06T08:36:04.000+0000

Feel free to reopen the issue if I have missed something.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts