Re: Parent File Constant?
| From: | Teodor Cimpoesu | Date: | Fri, 30 Jun 2000 18:15:10 +0000 |
| Subject: | Re: Parent File Constant? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4085@lists.php.net to get a copy of this message | ||
Hi Hans!
On Fri, 30 Jun 2000, Hans Lellelid wrote:
> > Example: main.php includes "header.php" and "footer.php". How does
> > header.php (or footer.php) know that it was called by main.php, and not
> some
> > other file?
>
you can build an array with includes like:
$me = basename(__FILE__);
$INC_FILES[$me] = get_included_files ();
and then, say for header.php, you make a lookup in it, and see who
`owns' it. Of course that means you must use include_once, and
also means get_included_files() should work as expected.
-- teodor