Welcome Guest, Not a member yet? Register   Sign In
Can't use helper function in controller
#6

[eluser]zsela[/eluser]
Thanks for your answer. You are right, I should go through the whole User Guide again more deeply.

However, it is still not working as you suggested:
Helper:

Code:
function entitle ($action) {

$entitled = 0;
$CI =& get_instance();  //get CI instance
$rights = $CI->session->userdata('rights');
for ($i = 0; $i < count($rights); $i++){
  if ($rights[$i] == $action) $entitled = 1;
}

return $entitled;
  
}

Controller:

Code:
$this->load->helper('common_functions');
Code:
if (entitle(1002)) {
    
    $this->load->view('admin/admin_index');
    
   }

This code still has a result of an empty page.


Messages In This Thread
Can't use helper function in controller - by El Forum - 02-13-2012, 02:52 PM
Can't use helper function in controller - by El Forum - 02-13-2012, 03:04 PM
Can't use helper function in controller - by El Forum - 02-13-2012, 03:14 PM
Can't use helper function in controller - by El Forum - 02-13-2012, 03:24 PM
Can't use helper function in controller - by El Forum - 02-13-2012, 03:29 PM
Can't use helper function in controller - by El Forum - 02-14-2012, 10:35 AM
Can't use helper function in controller - by El Forum - 02-14-2012, 10:50 AM
Can't use helper function in controller - by El Forum - 02-14-2012, 11:03 AM
Can't use helper function in controller - by El Forum - 02-14-2012, 01:11 PM
Can't use helper function in controller - by El Forum - 02-14-2012, 01:47 PM
Can't use helper function in controller - by El Forum - 02-14-2012, 04:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB