Re: include path file errors
| From: | John Hicks | Date: | Sat, 08 Apr 2006 16:18:41 +0000 |
| Subject: | Re: include path file errors | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-233558@lists.php.net to get a copy of this message | ||
kmh496 wrote:
> 2006-04-08 (토), 18:20 +0900, kmh496 쓰시길:
>
>>hi,
>>my webroot is
>>
>>/a/b/current/
>>
>>i am in /a/b/current/d/file.php
>>
>>file.php has a line
>>
>>require_once ($_SERVER[document_root]."/d/common.php");
>>
>>common.php has a line which says
>>
>>require_once ($_SERVER[document_root]."/_common.php");
>>// main include file for whole site
>>
>>it sends me no errors about missing files, but the variables inside main
>>include file _common.php are not set and don't exist in file.php
>>
>>where is my mistake?
>
> I am going to say this is screwed up. i can't include a file inside
> another included file and access its variables. all i can do is include
> the main file in every single file in a backwards manner -- reaching
> down the chain -- because i find that if i do 2 includes then the
> initail data is no longer included. but sometimes there is magic going
> on, but then i move one file and then the whole system breaks, it makes
> me crazy.
>
> even more so because i can't explain it well because it's so freaky.
>
> is there no tutorial on advanced php with all this include stuff?
>
> i RTMFM but the page didn't address advanced questions like that. and
> despite my english i believe i am advanced level.
>
> thankx everybody.
>
> joseph
Just a thought:
Are your variable definitions, by any chance, inside functions? That
would explain why they aren't set when you continue. The 'global'
statement will help in that case.
I can assure you that includes are not "advanced PHP". You should be
able to do what you are trying to do. There is no doubt a simple
explanation for your problem. Finding it is always the hard part.
Patience and perserverence and calm rational thought will get you there.
Good luck.
John