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.
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.
}