Welcome Guest, Not a member yet? Register   Sign In
explaining: $this->load->view();

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.

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

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.



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();

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:



Theme © iAndrew 2016 - Forum software by © MyBB