Easy Views Question

I'm new to CodeIgnitor and have a quick question on views.

I have a website that is going to be made up of a lot of dynamic components. The actual page content themselves will have dynamic content and the general site template will also have some dynamic content.

Is it proper to have Views reference other Views or must all views be called from the controller?

I load views within views and it does me no harm (In my opinion it does not break MVC as you are only loading more display data).

Be aware that a view loaded within a view will automatically have the same variables available as the 'parent' view, without having to pass data through the second parameter when using $this->load->view. (the same applies when you load a second view within the controller in the same page request)


What is the proper way to load them from a view? I'm not sure exactly how CI parses these, so can I still use $this->load->view("") inside of the view or is there another "proper" way to do it. I could just throw in a <?php include_once(""); ?> in the view but would rather do it the "CI way".

works for me. you still have access to $this-> in the views.

*you cannot call controller functions through $this-> once in a view though.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.