I would like to make cross variables in my template via the router.
I want to do:
$router->with(array(...));
Here is my with function:
public function with($vars)
{
if(is_array($vars))
{
foreach ($vars as $key => $value)
{
$$key = $value;
}
}else
{
die("La fonction with() demande un tableau en paramètre.");
}
}
Am I on the right track?
with()function, and be destroyed as soon as the function exits.