Need more to say, guys? Read below...
> -----Original Message----- > From: Mikhail Avrekh [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 04, 2002 10:43 PM > To: Maxim Maletsky > Cc: 'Philip Hallstrom'; [EMAIL PROTECTED] > Subject: RE: [PHP] Re: included file name -- DOCS ? > > Thanks guys, this is just what I needed ! > > I'm just surprised that this does not seem to be really documented > anywhere. The only place where I could find this is in the "Reserved > Keywords" section of the manual, where __FILE__, __LINE__ , "const" and > "use" do not have links to explanatory pages of their own. > > http://www.php.net/manual/en/reserved.php > > I've submitted a comment (user note) to this page in regard to __FILE__ > and would be happy if my comment or some version thereof is used as the > doc page for this keyword (I guess I could set this up myself, I just > don't know how). However, wouldn't it make more sense if __FILE__ and > __LINE__ were in the "Constants" section rather than in "Reserved > Keywords" ? > > Another note -- these two keywords are impossible (I think) to find > through a direct search because it strips the underscores, and the search > returns some unrelated pages. > > M. > > On Thu, 4 Apr 2002, Maxim Maletsky wrote: > > > > > 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