I am trying to get my $viewData into local variables. Here is my function:
function view($layout, $view, $var)
{
extract($var);
include($layout);
}
Here is how I am using it:
$viewData = array($hasImages->arr, $latest->arr, $mostViewed->arr, $all->arr, $this->error);
$this->view('/view/shared/layout.php', '/view/home.php', $viewData);
The extract method works fine on the $this->error string, but not on any of the arrays such as $hasImages->arr. It doesn't seem to create the variable in the local context.
How can I get my arrays into my function?