Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to add and show custom menu items on header after user login
  • eg.In header ,show 5 menu items before user login.
    after login ,show new 2 menu items PROFILE and LOGOUT ,totally 7 items 
    after user logout,show only 5 menu items .
    All page will show this header  including logo and menu just like at fuelphp forum.
    please guide me.thanks..

  • HarroHarro
    Accepted Answer
    In your controller:

    return \View::forge('myview')->set('is_logged_in', \Auth::check());

    in your "myview" view:

    <php if ($is_logged_in): ?>
    <a href="/logout">Logout</a>
    <?php else: ?>
    <a href="/login">Login</a>
    <?php endif; ?>

    for example... ;-)

    You should do this in a presenter as it's not really controller code, but most people can't be bothered to setup a presenter for only one line of code.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion