This topic is locked

Importing a variable

10/22/2011 6:15:35 PM
PHPRunner General questions
T
Tempus_Erus author

Good evening all,
I have a conundrum. Tried many ways but yet to resolve.
In my edit section > insert php snippet > part of my program (in a tabbed section) I need to 'include' a relative file. I use PHP include ('/path.php'); in the 'insert snippet section' and this works ok.
However, I need to pass a variable in the 'php snippet' part of the program into the file to be included or have the included file 'recognise' the variable I have created outside of the included file in the 'php snippet' part of the program.
I understand this so far as creating a global variable called (for example) '$atest'. In the file I now 'include' - I need to 'call' this variable '$atest' for execution within the include file.
Yep clear as mud! lol. if anyone can understand what I am getting at I would appreciate any help.
To try and clarify a little more:
global $key;

$a = $key['id'];

include ('./path.php');
its the path.php that needs to 'import' $a in this case..............
Many thanks in advance.
TE