dsdf64562672
dsdf64562672
采纳率0%
2012-12-16 21:54

在zend改变菜单栏

已采纳

Hy,

I have managed to make a top menu bar in Zend Framework and the code is placed in layouts/scripts/layout.phtml, and i have the followind items: Item1, Item2, Item3, Login, Register. What i want is that when somebody logs in, to change the last 2 elements, replace Login and Register with Logout. Can someone help me with something please? I readed something about placeholders, but i don`t understand them clearly.

Thank you.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dongqu3623 dongqu3623 9年前

    Since it sounds like you are using a view-script (rather Zend_Navigation) for your menu, it should relatively straightforward to include a check as follows right in layouts/scripts/layout.phtml:

    // Render your static menu elements
    // render, render
    
    // Now handle the dynamic part
    if (!Zend_Auth::getInstance()->hasIdentity()){
        // Render the `Register` and `Login` links.
    } else {
        // Render your `Logout` link.
    }
    
    点赞 评论 复制链接分享

为你推荐