RE: [PHP] $_SERVER['PHP_SELF'] in a included file
| From: | Vincent DUPONT | Date: | Mon, 26 Feb 2007 13:47:58 +0000 |
| Subject: | RE: [PHP] $_SERVER['PHP_SELF'] in a included file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249441@lists.php.net to get a copy of this message | ||
hello,
try with the system constant __FILE__
print(__FILE__);
inside a.php should always return a.php, even though this is included into index.php.
Vincent Dupont
Principal Consultant OpenSource Competence Center
Ausy Belgium
http://www.ausy.be
-----Original Message-----
From: clive [mailto:clive@rttc.co.za]
Sent: Mon 2/26/2007 14:44
To: PHP General List
Subject: [PHP] $_SERVER['PHP_SELF'] in a included file
A project that I work on has a index.php that includes other files
depending on certain requirements.
so index.php includes a.php;
in a.php if you echo $_SERVER['PHP_SELF'] it echos index.php and I
understand why it does this.
But, I want echo the file name of a.php from a.php and I dont want to
add a $filename='a.php'; at the top of a.php, although I have thought of
using subversion and a find and replace to insert $filename="$Id$"; at
the top of all the files.
Does anyone know know of another way I can get a included files filename?
Sorry if I have posted this question in the past, its been a while since
I last thought of this problem.
Regards,
Clive.
Real Time Travel Connections
{No electrons were harmed in the creation, transmission or reading of
this email. However, many were excited and some may well have enjoyed
the experience.}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php