My project uses a template system to put the pages together and there are many variables involved. Usually the template is loaded directly from an index file and not from within a function.
However, at the moment I'm simply making this function to display an error page:
function show_error($error){ global $root; global $template; $content=$root."/includes/pages/error_page.html.php"; include $root . $template; exit(); } However, since the template uses many variables outside the scope of this function, it just comes up with lots of variable not found errors.
Is there a way of simply making all global variables available inside of a function? I'd rather not individually declare all possible variables inside as it would be quite tedious and because I am often adding more variables in the template.