Re: Parent File Constant?

From: Date: Fri, 30 Jun 2000 15:51:34 +0000
Subject: Re: Parent File Constant?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-4045@lists.php.net to get a copy of this message
> 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? $PHP_SELF will contain the name of the including script--if it is the top script (i.e. not included by any other script). In your example, referencing $PHP_SELF in header.php or footer.php will return "main.php" (-- or more precisely, the path for "main.php" relative to the $DOCUMENT_ROOT). Of course, this will only if your parent script is the top script...otherwise you'd have to use a variable, I guess (i.e. I don't know). Hans Lellelid ----- Original Message ----- From: "Cosenza, Mario" <mcosenza@engsvcs.com> To: <php-general@lists.php.net> Sent: Friday, June 30, 2000 11:27 AM Subject: [PHP] Parent File Constant? > I've been looking through the list archives and the manual, but can't find > out... > > how to get the name of the parent file (from an include statement). > > 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? > > Is there a php constant or function that returns the parent file path/name? > Or do I have to set a variable before my include statement? > > Thanks, > > mario > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#4045) next »