Welcome Guest, Not a member yet? Register   Sign In
Reuse HTML Block
#2

[eluser]BradEstey[/eluser]
Whenever you pass an array into a view, the extract() function is run on the array. So for example if you include a view using:

Code:
$data = array('color' => 'blue',
                         'type' => 'large');
$this->load->view(‘BlockView’,$data);

The in BlockView.php you would call these as variables $color and $type.

It's also worth noting that you can include $this->load->view(‘BlockView’); directly in your main view and all of the data that you passed to the parent view will automatically be accessible from your BlockView view. Just like an include().


Messages In This Thread
Reuse HTML Block - by El Forum - 07-15-2011, 01:39 AM
Reuse HTML Block - by El Forum - 07-15-2011, 01:21 PM
Reuse HTML Block - by El Forum - 07-16-2011, 11:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB