Welcome Guest, Not a member yet? Register   Sign In
including external files & global scope
#1

[eluser]Unknown[/eluser]
Hi,

I inherited a legacy project that is not using any framework at all. I am wanting to use code igniter, but I still need to include some external php files while maintaining their path. These files cannot be changed Sad

But here is the prob.. I include the file, but its global variables do not carry.

So a function like this:

function getAppid($appid)
{
global $appid_array; // is filled in with more includes and array declaration at top
$lookup_key = $container . "_" . $appid;
if(!isset($appid_array[$lookup_key]){
//etc
}
}

The 'global' is not being carried over into CI, or somehow it gets removed. If I hardcode what that global should be in the function, it works, but I cannot change these files as the company uses this throughout its apps.

Any help???? Sad




Theme © iAndrew 2016 - Forum software by © MyBB