[eluser]kimp[/eluser]
I have several views which show additional information if the user is an admin. These views include the following code:
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:
Code:
<?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!