CodeIgniter Forums
Navagation view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Navagation view (/showthread.php?tid=12458)



Navagation view - El Forum - 10-20-2008

[eluser]Moon 111[/eluser]
I have a view that I call in all my views that has the Naviagation Bar. I know need the Navigation Bar to be dynamic. How am I supposed to do this? For example, if a user is logged in they need a "logout" link, however, when they are logged out, they need a "login" link.

All help would be greatly appreciated,

- Moshe


Navagation view - El Forum - 10-20-2008

[eluser]Moon 111[/eluser]
Maybe I'll create and autoload a helper that can be used for that stuff? That way it can be used in the view too.


Navagation view - El Forum - 10-20-2008

[eluser]Aken[/eluser]
You can add PHP code to your view that checks to see if the user is logged in, and displays the appropriate information.


Navagation view - El Forum - 10-20-2008

[eluser]Moon 111[/eluser]
Can I load a Controller from a view?


Navagation view - El Forum - 10-20-2008

[eluser]Colin Williams[/eluser]
I would write a Menu library (or Model) that handles it. Controllers and Libraries, and maybe even Models, would be responsible for adding items to the menus that the Menu library controls. No need to call a Controller from the View in this case.