All geek questions in one place

Zend Navigation - various navigation blocks

I have a file navigation.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <nav>
        <programm_nav>
            <label></label>
            <uri>#</uri>
            <pages>
                <all>
                    <label>test1</label>
                    <resource>default:programme</resource>
                    <module>default</module>
                    <controller>programme</controller>
                    <action>list</action>
                    <privilege>index</privilege>
                </all>                      
            </pages>
        </programm_nav>
        <acc_nav>
        <label></label>
            <uri>#</uri>
            <pages>
                <ueb>
                    <label>test2</label>
                    <resource>default:account</resource>
                    <module>default</module>
                    <controller>account</controller>
                    <action>index</action>
                    <privilege>index</privilege>
                </ueb>                      
            </pages>
        </acc_nav>
    </nav>
</config>

This configuration file defines two navigation blocks: one program_nav and the other acc_nav.

In my bootstrap, I do the following:

$navContainerConfig = new Zend_Config_Xml ( APPLICATION_PATH .
'/configs/navigation.xml', 'nav');     

$navContainer = new Zend_Navigation ( $navContainerConfig );

$view->navigation ( $navContainer )->setAcl ( $this->_acl )
->setRole ( Zend_Registry::get ( 'role' ) );

In my opinion, I show the navigation:

$navSec = $this->navigation ()->findOneByLabel ( 'acc_nav' );
echo $this->navigation ()->menu ()->renderMenu ( $navSec );

But no matter how I define $navSec, I always show programm_navand never add a box. acc_navnever displayed.

Any idea?

+3
php zend-framework zend-acl zend-navigation
Lost in owl Sep 23 '10 at 9:57
source share
2 answers

findOneByLabel('acc_nav');will look for text in <label>-tags, since there is a nog acc_nav value . He will not find it.

+1
tom Sep 23 '10 at 10:51
source share

, ....

: test1 test2.

ACL, , . , , ACL .

, , script. , , , , ZF, . .

Bootstrap

function _initNav()
{
    $navContainerConfig = new Zend_Config_Xml ( APPLICATION_PATH . '/configs/navigation.xml', 'nav');     

    $navContainer = new Zend_Navigation ( $navContainerConfig );

    Zend_Registry::set("navigation", $navContainer);        
}

<?php

    $navSec = $this->navigation(Zend_Registry::get("navigation"))
        ->findOneByLabel( 'acc_nav' );

    echo $this->navigation()->menu()->renderMenu( $navSec );

?>
0
Jake N 23 . '10 10:51

Source: https://habr.com/ru/post/1766179/

More articles:

  • How can netTcpBinding be slower than wsHttpBinding? - wcf
  • reverse engineering tools for java - java
  • Can I use gitg to view changes in only one file / directory? - git
  • How to list all columns of a given SQL query - sql-server
  • Where do four or gowalla get location data? - api
  • C # Console App Threading? - multithreading
  • GWT TabLayoutPanel does not display chart contents - gwt
  • Who set IsPostBack to asp.net - asp.net
  • Overloading names and properties in VB.NET - enums
  • How to find the name of a branch of a transparent form - clearcase

All Articles

Geek Questions | 2019