I’ve read through the source code but it seems a little cryptic. I’m just trying to get my head around how CI transforms an array into individual variables available to the view.
I gather that the view is included with include(), but the variables seem to only be effective for the view.
Controller:
$this->load->view('about', array('title' => 'about'));
View:
<?php echo $title; // shows 'about' ?>
php extract() function
The variables $test and $key would be “visible” in the view only if they are declared localy, so let’s say a function includes the view file and right before including it, it will extract the values, then the variables would be visible only inside that function ( witch body would contain the view file too ), it’s not realy how CI does it but it explains the principle .