Welcome Guest, Not a member yet? Register   Sign In
Losing $data inside views that have been included by another view, think it's HMVC related.
#2

[eluser]boltsabre[/eluser]
Hmmmm, not looking good...

I've checked it out, looks like the load function in MX_Loader (line 253)
Code:
/** Load a module view **/
public function view($view, $vars = array(), $return = FALSE) {
   list($path, $view) = Modules::find($view, $this->_module, 'views/');
   $this->_ci_view_path = $path;
   return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
}
Is not receiving the second variable $vars...

So I can get around this issue by passing it in, in my view such as this:
Code:
<div class="twoColDivTwo">
   &lt;?php $this->load->view('includes/likeRHSColumn', $data = array('no_checklist_display' => $no_checklist_display)); ?&gt;
</div>
And hey presto, by variable $no_checklist_display has now been passed from the main view to the "sub" view "likeRHSColumn" (because the variables are available in the view called directly from the controller, but not in views called by views).

BUT BUT BUT this is NOT how it's meant to work.

It's been a hard day of debugging this crap, need to hit the sack now, but if ANYONE has an idea or can point me in the right direction I'd be extremely grateful. Thanks.


Messages In This Thread
Losing $data inside views that have been included by another view, think it's HMVC related. - by El Forum - 12-05-2012, 02:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB