CodeIgniter Forums
explaining: $this->load->view(); - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: explaining: $this->load->view(); (/thread-29448.html)

explaining: $this->load->view(); - El Forum - 04-09-2010

in a controller you can use this method to load a view.

but i want to know behind the scenes here.

im new to php and frameworks, but i've learned the basics of OOP.

when $this->view() is made then the method in the current class or the parent class is used.

but what does this mean: $this->load->view(). what is the intermediate load? is it a function or is it a property?

where is it located? how could it contain view()?

grateful for explanation.

explaining: $this->load->view(); - El Forum - 04-09-2010

What you are looking for is exactly on system\libraries\Loader.php between lines 288 and 308.

explaining: $this->load->view(); - El Forum - 04-09-2010

thanks. so that function would explain the view(). but where can i find the load property?

cause i want to understand the chain between $this->load->view().

this is the downfall of not having a full api reference available. its difficult to check what extends what, and what classes are instantiated in which properties so one can get the whole picture quicker.

yii and java have good api reference that im used to to get the full picture.

explaining: $this->load->view(); - El Forum - 04-10-2010

Thats a bit more difficult to explain. As you know there is a CI_Loader class in CodeIgniter. Well CodeIgniter loads this for you and saves the instance into the load property of the 'Core Object'.

When you create a controller you always extend Controller and call the parent constructor. By doing this it means this 'Core Object' is available to you in your class by using $this. So in you controller you can now do calls to $this->load. As since we have the CI_Loader class in the load property we can call it as well. $this->load->view();

explaining: $this->load->view(); - El Forum - 04-10-2010

Ok i get it. I wonder which class this Core Object is instantiated from and WHERE this instantiation occur. And also WHERE CodeIgniter saves the instance of CI_Loader to the load property.

I just want to know where these 2 events occur. But the latter one is most relevant.

this is the downfall of not having a api reference available for getting the big picture of which class are extending whom and what classes are instantiated to what properties.

yii and java have excellent api reference documentation: