Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
How to add and show custom menu items on header after user login
khinthantsin
December 2015
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..
WanWizard
December 2015
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.
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,090
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
262
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
WanWizard
December 2015