Welcome Guest, Not a member yet? Register   Sign In
Accessing member and function from View file
#1

[eluser]Tanvir[/eluser]
Hello , I m new to CI. I noticed that-

The view file doesn't need to load any model or controller class to get the functions therein.I send the data by $data['query'] = $this->Blog_Model->showTable(); in from controller and I can use the $query->num_rows()function in view file . Does it mean that once a library/plugin etc is loaded in controller and u can access the object , u can access the functions and variables in view file without any problem/ loading it in view file.

One more thing, I loaded the model in controller constructor -$this->load->model('Blog_Model');

But I can access its function in controller index function- $this->Blog_Model->showTable();
How come I can access 'Blog_Model' object which is initialized in constructor. Does it make the object public for the whole script.




Theme © iAndrew 2016 - Forum software by © MyBB