Welcome Guest, Not a member yet? Register   Sign In
How to access protected controller attributes from views

I have several views which show additional information if the user is an admin. These views include the following code:
<?if ($this->session->userdata('userType') == 'Admin'): ?>

I have been trying to shorten this by setting a protected attribute in the controller, and testing this attribute (instead of the session userdata). The view code would then be something like:
<?if ($this->is_admin):?>

When I do this however I'm receiving the error message Undefined property: CI_Loader::$is_admin.

How can I make the controller's protected attributes available to the views (without explicitly passing them as part of the content array)? Or should I just make the attributes public?

Any assistance appreciated!

Theme © iAndrew 2016 - Forum software by © MyBB