Posted by Oliver Grδtz on 10/14/05 18:19
Claudio schrieb:
> I'm using PHP 5. I have a class operation that includes php files.
> Is there a way to include this files to global scope? So that difined vars
> and functions are global accesseble?
I know this problem from my early PHP days. If your problem is that you
want to include some class or function libraries then the simple
solution is: Do not include inside the function or class but let the
class or function just return the path name!
So instead of
function include_lib($name)
{
$path='functions/'.$name.'.php'; // or more werid stuff
include($path);
}
include_lib('test');
do
function lib_path($name)
{
$path='functions/'.$name.'.php'; // or more werid stuff
return $path;
}
include(lib_path('test'));
Perhaps your problem is exactly of this type or similar.
AllOLLi
____________
Inara: "It sounds like the sort of thing this crew can handle. I can't
guarantee they'll handle it particularly well, but..."
Nandi: "If they got guns, and brains at all..."
Inara: "They've got guns."
[firefly 113]
Navigation:
[Reply to this message]
|