CodeIgniter Forums

Full Version: Question about The Authentication Library
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Using Adam Griffiths' Auth Library and I'm wondering if it's possible to have an admin element on a page that is not in the Admin backend.

For example, my structure looks like this:


Now, if someone goes to*id*, it pulls up the project info.

However, if I am an Admin, and I've already logged in - and I go to that page to view it, I still want to see some Admin navigation elements - such as "upload to this project" or something like that.

is it as simple as running a conditional statement?

if authenticated -> display nav menu

Another scenario - Think about WordPress...when you are making changes in the Admin panel, and then you click "View Post" - at the bottom of that post, there is a link that says "Edit this post" or "edit this page".

El Forum

Yeah, just use a conditional statement for that. You can have it within the view, just something like

<?php if(authenticated): ?>

<b> Admins are cool </b>

&lt;?php else: ?&gt;

<b>Users aren't</b>

&lt;?php endif; ?&gt;

or if you will be displaying a lot of differences, you could create two different view and load one for admin and one for everyone else.