Try this:

function whatFile($f) {
        $LOCALS['fname'] = $f;
}


$then in the file of yor interest do this:

whatFile(__FILE__);


and wherever next you will want to have that value the file name will be
within $fname;


Sincerely,

Maxim Maletsky
Founder, Chief Developer

PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com


> -----Original Message-----
> From: Philip Hallstrom [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 04, 2002 2:28 AM
> To: Mikhail Avrekh
> Cc: [EMAIL PROTECTED]
> Subject: [PHP] Re: included file name
> 
> Check the constants section of the manual...
> 
> __FILE__ (case-insensitive)
> 
> The name of the script file presently being parsed. If used within a
file
> which has been included or required, then the name of the included
file is
> given, and not the name of the parent file.
> 
> 
> On Wed, 3 Apr 2002, Mikhail Avrekh wrote:
> 
> > Hello,
> >
> > Is there any way inside an included file to figure out what its
actual
> > UNIX filename is ?
> >
> > For example:
> >
> > file1.php --
> > <?
> >
> > include("file2.php");
> >
> > ?>
> >
> > file2.php --
> > <?
> > /*want to do something like:
> >     if (this_file()=="file2.php") {
> >             ## do stuff
> >     } else if (this_file()=="file1.php") {
> >             ## do other stuff
> >     }
> > */
> > ?>
> >
> > That is, file2.php needs to know whether it's executed in the
context of
> > file1.php or autonomously. I guess I could change $PHP_SELF before
> > including file2.php in file1.php, but that seems like a bad hack,
plus it
> > may screw up other code in file1.php, if there is any.
> >
> > Any suggestions ?
> > M.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to