OK so I have tried to research why this is not working, it is beyond me now. So please forgive me.
I have a PHP Document called include.php that has 2 lines in it to require certain files.
require('/srv/testwebsite.com/public/htdocs/includes/defs.php');
require_once('/srv/differenttestwebsite.com/public/htdocs/includes/functions.php');
I then require this doc on another PHP script at the very top so that I can use the Functions created within functions.php and the definitions and global arrays within the defs.php
require('/srv/crm.testweb.com/public/htdocs/includes/include.php');
Some of the arrays in defs are called $acpDropdowns and are setup as:
$acpDropdowns['abc'] = array('some'=>'thing','like'=>'this');
$acpDropdowns['xyz'] = array('this'=>'that','etc'=>'etc');
In my functions I have a function called openWizard and its setup like this:
function openWizard($action,$postTo,$id,$user,$update)
{
global $acpDropdowns;
......
}
When I use the $acpDropdown arrays within this function nothing is populated. To test this I entered:
echo "<pre>".$acpDropdowns."</pre>";
function openWizard($action,$postTo,$id,$user,$update)
{
global $acpDropdowns;
if(!$acpDropdowns)
{
echo "No Dropdowns";
}
.....
}
What this resulted in was when I loaded my page and included the include.php file was a full array of the $acpDropdowns as expected and then when I called the function I got "No Dropdowns"
I think I have given as much as possible, I have also run
if(!$acpDropdowns)
{
$included = get_included_files();
echo "<pre>{$included}</pre>";
}
And this output shows that the defs.php file is actually included!
';` – Daryl Goode Oct 11 '16 at 15:22