[dokuwiki] Re: PHP and global question

  • From: Morten Lemvigh <lemvigh@xxxxxxxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Thu, 01 Nov 2007 10:05:41 +0100

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?

I find it strange too, that when I use a file test.php in the same directory as doku.php containing the same code, as I try to embed in the wiki, there's no problems at all?!

/Morten

--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: