开发者

Errors in Zend framework navigation , can someone help?

http://site2.example.com/ Error=>

Notice: Trying to get property of non-object in /var/www/site/application/layouts/scripts/layout.phtml on line 19 Call Stack: 0.0003 335220 
1. {main}() /var/www/site/public/index.php:0 0.0710 4242640
2. Zend_Application->run() /var/www/site/public/index.php:26 0.0710 4242640
3. Zend_Application_Bootstrap_Bootstrap->run() /var/www/site/library/Zend/Application.php:366 0.0711 4242712
4. Zend_Controller_Front->dispatch() /var/www/site/library/Zend/Application/Bootstrap/Bootstrap.php:97 0.1046 5601136
5. Zend_Controller_Plugin_Broker->postDispatch() /var/www/site/library/Zend/Controller/Front.php:965 0.1046 5601136
6. Zend_Layout_Controller_Plugin_Layout->postDispatch() /var/www/site/library/Zend/Controller/Plugin/Broker.php:331 0.1048 5601500
7. Zend_Layout->render() /var/www/site/library/Zend/Layout/Controller/Plugin/Layout.php:143 0.1056 5605568
8. Zend_View_Abstract->render() /var/www/site/library/Zend/Layout.php:796 0.1057 5646952
9. Zend_View->_run() /var/www/site/library/Zend/View/Abstract.php:880 0.1060 5662656
10. include('/var/www/site/application/layouts/scripts/layout.phtml') /var/www/site/library/Zend/View.php:108

This is the code =>

<head>
<?php echo $this->headScript()->appendFile($this->baseUrl() . '/js/jwplayer.js'); ?>
<?php echo $this->headScript()->appendFile($this->baseUrl() . '/js/swfobject.js'); ?>
<?php echo $this->headLink()-&g开发者_Go百科t;prependStylesheet($this->baseUrl().'/css/topmenu.css'); ?>
</head>

<?php
    $flXml=new Zend_Config_Xml(APPLICATION_PATH.'/configs/navigation.xml','nav');
    $container = new Zend_Navigation($flXml);
    Zend_Registry::set('Zend_Navigation', $container);
?>

<div id="nav-menu">
    <?php
        $obj_menuacl=new Model_MenuAcl();

        $_auth=Zend_Auth::getInstance();

        echo $this->navigation()->menu()->setAcl($obj_menuacl)->setRole($_auth->getStorage()->read()->uid);
        echo $this->loggedInAs();
        echo '<br><br>';
        echo 'You are in: ' . $this->navigation()->breadcrumbs()->setLinkLast(false)->setMinDepth(0)->render();
    ?>
</div>
<div class="mainbody"><?php echo $this->layout()->content; ?></div>
<br />

What should i do ?

Where is the error ?

This is the line number 19 =>

echo $this->navigation()->menu()->setAcl($obj_menuacl)->setRole($_auth->getStorage()->read()->uid);

If i try to print it=> echo $_auth->getStorage(); <=it results that error message.


If I had to guess, I'd say it was this

$_auth->getStorage()->read()->uid

as this is the only attempt to get a class property on that line (everything else is a method).

It seems that whatever is returned by Zend_Auth_Storage_Interface::read() is not an object. As this is something you set in your own code, I cannot offer any further advice other than to debug the return value of read().

Update

I'd attempt to fix it like this but without knowing more about your application, I'm only guessing.

$_auth = Zend_Auth::getInstance();

$uid = $_auth->hasIdentity() ? $_auth->getIdentity()->uid : null;

echo $this->navigation()->menu()->setAcl($obj_menuacl)->setRole($uid);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜