Call model not work |
Hi,
I find myself trying codeigniter 3, but I have a very rare problem. I have the following classes: PHP Code: class Recursos extends CI_Controller { and my model is: PHP Code: class Recursos_model extends CI_Model{ PHP Code: class Permisos_model extends CI_Model{ With Recuros_model does not work, however, with Permisos_model if it does. What do you think the problem is?
What doesn't work? Do you get an error?
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
(01-03-2017, 11:17 AM)albertleao Wrote: What doesn't work? Do you get an error? This error is: A PHP Error was encountered Severity: Notice Message: Undefined property: Recursos::$recursos_model Filename: controllers/Recursos.php Line Number: 12 Backtrace: File: C:\xampp\htdocs\invent\application\controllers\Recursos.php Line: 12 Function: _error_handler File: C:\xampp\htdocs\invent\index.php Line: 315 Function: require_once
I use acl for restriction over hook:
class ACL { private $perms; private $role_field; private $CI; public function __construct() { $this->CI =&get_instance(); if (!isset($this->CI->session)) { # Sessions are not loaded $this->CI->load->library('session'); } if (!isset($this->CI->router)) { # Router is not loaded $this->CI->load->library('router'); } if (!isset($this->CI->url)) { # Router is not loaded $this->CI->load->helper('url'); } $this->CI->load->model('permisos_model'); //$this->CI->load->model('recursos_model'); <- work if enable here if($this->CI->session->userdata('rolID')){ $this->role_field = $this->CI->session->userdata('rolID'); } else $this->role_field = 0; $hola = $this->CI->permisos_model->getAllow(); foreach ($hola->result_array() as $key => $value) { $this->perms[$value['rolID']][$value['controller']][$value['metod']] = ($value['status'] == 1) ? TRUE : FALSE; } } But it is no longer necessary to state in the controller constructor, what problems or what would help or hurt this situation?
What is the filename of the models?
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
change this code
$sql = "select * from tab_recursos where idparent =".$parent; Sercan YANBULOGLU
SEO links REDACTED, per forum policy
Why do people still use native sql in their queries when we have the query builder class? The only time it is necessary is if you're doing a complex join or something.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
|
Welcome Guest, Not a member yet? Register Sign In |