[dokuwiki] Re: PHP and global question
- From: Myron Turner <turnermm02@xxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Thu, 01 Nov 2007 09:22:38 -0500
Morten Lemvigh wrote:
Myron Turner wrote:
It sounds like a path problem.
When you include the nested file in myclass.php, do you use an
absolute path name or a relative pathname?
What I have is something like:
in included.php:
----------------------
$myVar = "message";
----------------------
and in myclass.php:
----------------------
require_once "included.php";
echo $myVar
class MyClass {
...
global $myVar
echo $myVar
}
----------------------
Outside the class in myclass.php, there is no problem. But inside
MyClass i cannot access $myVar. Both files are in the same directory,
but in a different directory from doku.php. All inclusions are
relative. But I don't see, how entering a class definition should
do anything to the path?
Right. The file included.php has been included, because in the global
scope the code has access to $myVar. So, it's not a path problem.
Let use know if you solve the problem,
Myron
--
_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
- References:
- [dokuwiki] Re: PHP and global question
- From: Morten Lemvigh
Other related posts:
- » [dokuwiki] PHP and global question
- » [dokuwiki] PHP and global question
- » [dokuwiki] Re: PHP and global question
- » [dokuwiki] Re: PHP and global question
- » [dokuwiki] Re: PHP and global question
- » [dokuwiki] Re: PHP and global question
- » [dokuwiki] Re: PHP and global question
- » [dokuwiki] Re: PHP and global question
Myron Turner wrote:
It sounds like a path problem.When you include the nested file in myclass.php, do you use an absolute path name or a relative pathname?
What I have is something like:
in included.php:
----------------------
$myVar = "message";
----------------------
and in myclass.php:
----------------------
require_once "included.php";
echo $myVar
class MyClass {
...
global $myVar
echo $myVar
}
----------------------
Outside the class in myclass.php, there is no problem. But inside
MyClass i cannot access $myVar. Both files are in the same directory,
but in a different directory from doku.php. All inclusions are
relative. But I don't see, how entering a class definition should
do anything to the path?
- [dokuwiki] Re: PHP and global question
- From: Morten Lemvigh