Is it possible to pass an argument when using an include statement? ie <!--#include virtual="table.inc?arg=test" -->
This is causing errors for me. Is there another way of doing this? I'm very new to PHP, so please don't get too technical 😉
Thanks!
With an include, any vars declared are also visible from the include file (except in the functions).
For the example you have given, just declaring arg=test is enough for it to be visible in the include file.
When including files the variables from the main file will pass on to the included file. Try this
<?php $arg="test"; include "table.inc" ?>
table.inc will be able to use/modify $arg.
If you need $arg in a function try this!
<snip> this is table.inc <?php function whatever() { globel $arg;
--> rest of your code... } ?>
Thanks guys! Got it working.