Change Navigation If Logged In


#1

What is the best way to code part of a website such as the navigation bar which has different links depending on whether the user is logged in or not.

Some options i can think of;

  1. Have a different layout for each (this would get called in the controller for each function?
  2. Use 2 different elements and have an if statement in the layout to check if anyone is logged in, the logged in option needs to display user data too.

I’m a novice at cake so any help appreciated (code examples would be amazing too!)


#2

I think your second option is enough for it. I don’t know if there is some
better way, but that’s good enough.