[dokuwiki] Re: PHP and global question

Have you tried adding some log statements to see what code gets run
when.  The order of execution may no be what you'd expect.

On 11/1/07, Morten Lemvigh <lemvigh@xxxxxxxxxxxxxxxxxxx> 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?
>
> 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
>
-- 
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: