Suppose I am logged in as admin group, then when I access main_page, there is an 'Export' button. But if I am in members group, it will not be showed up.
Recently, I was thinking to use if
logic in views. Is it right? Or I still have to use logic on controller?
You can check user type in controller and pass it to view
Controller
if ($this->ion_auth->is_admin())
{
$this->data['user_type'] = 'admin';
}
else if($this->ion_auth->logged_in()){
$this->data['user_type'] = 'member';
}
Now you can use same variable in view to process your data. Yes you have to write ternary operator/if condition to check
View
($user_type == 'admin') ? 'statment_code_here' : 'statment_code_here';
In case of multiple conditions check in view, you can use if else statements.