473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to get file name from which current executing file is invoked???

hi

how can i get the file name from which the current executing file is
called.
i m making a scrript which will be called from many other scripts.
this script performs some calculation and then returns the result to
the script who asked for. so i want to know the script name of caller
script in the current executing script

thxs for your help in advance.

Jul 17 '05 #1
6 4046
vishal <vi************@yahoo.co.in> wrote:
how can i get the file name from which the current executing file is
called.
Dump phpinfo(32) and you'll probably see the info you are looking for.
i m making a scrript which will be called from many other scripts.
this script performs some calculation and then returns the result to
the script who asked for. so i want to know the script name of caller
script in the current executing script


I don't get it. Why do you need to know the caller? If you
include/require the "script library" return value/output will get back
to the caller automatically.

Jul 17 '05 #2
On 30 Mar 2005 12:49:43 GMT, Daniel Tryba
<pa**********@invalid.tryba.nl> wrote:
vishal <vi************@yahoo.co.in> wrote:
how can i get the file name from which the current executing file is
called.


Dump phpinfo(32) and you'll probably see the info you are looking for.
i m making a scrript which will be called from many other scripts.
this script performs some calculation and then returns the result to
the script who asked for. so i want to know the script name of caller
script in the current executing script


I don't get it. Why do you need to know the caller? If you
include/require the "script library" return value/output will get back
to the caller automatically.


I agree, I'd make the called file an include/require, but if this is
not possible for whatever reason then you should be able to do
something with $_SERVER["HTTP_REFERER"] and extract the name of the
calling file from that.


Jul 17 '05 #3
[-= Chris =-] <Ch************@nez.oc.ku> wrote:
I don't get it. Why do you need to know the caller? If you
include/require the "script library" return value/output will get back
to the caller automatically.


I agree, I'd make the called file an include/require, but if this is
not possible for whatever reason then you should be able to do
something with $_SERVER["HTTP_REFERER"] and extract the name of the
calling file from that.


Will in that case I would add an extra form element/get paramter/header
to the request to tell the script who called it. referrer is totally
unreliable.

Jul 17 '05 #4
"vishal" <vi************@yahoo.co.in> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
hi

how can i get the file name from which the current executing file is
called.
i m making a scrript which will be called from many other scripts.
this script performs some calculation and then returns the result to
the script who asked for. so i want to know the script name of caller
script in the current executing script

thxs for your help in advance.


debug_backtrace() will give you the info. In general though, it's not a good
practice to use includes in lieu of functions. Better to wrap the code in a
function, and have the calling code pass a parameter explicitly stating the
required behavior/results.
Jul 17 '05 #5
Lots of these:

echo "<!-- page = $page -->";
or
echo "<!-- function showForm -->";

Low tech but works in a pinch if you are outputting to html.

John
"Daniel Tryba" <pa**********@invalid.tryba.nl> wrote in message
news:42*********************@news6.xs4all.nl...
[-= Chris =-] <Ch************@nez.oc.ku> wrote:
I don't get it. Why do you need to know the caller? If you
include/require the "script library" return value/output will get back
to the caller automatically.


I agree, I'd make the called file an include/require, but if this is
not possible for whatever reason then you should be able to do
something with $_SERVER["HTTP_REFERER"] and extract the name of the
calling file from that.


Will in that case I would add an extra form element/get paramter/header
to the request to tell the script who called it. referrer is totally
unreliable.

Jul 17 '05 #6
vishal wrote:
<snip>
so i want to know the script name of caller
script in the current executing script


__FILE__

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: Jacek Generowicz | last post by:
I would like to write a metaclass which would allow me to overload names in the definition of its instances, like this class Foo(object): __metaclass__ = OverloadingClass att = 1 att = 3
2
by: Suresh Gladstone | last post by:
Hi, This is a bit with versioning and installation of the .NET dlls. I want to perform the following, 1. A third party application will be invoking my .NET dll through COM interop . For this I...
0
by: rilian | last post by:
For those encountering the 'Error executing child request for...' error, the following may bring some light on the problem. It is possible that the page you are transfering/executing to is...
27
by: comp.lang.tcl | last post by:
My TCL proc, XML_GET_ALL_ELEMENT_ATTRS, is supposed to convert an XML file into a TCL list as follows: attr1 {val1} attr2 {val2} ... attrN {valN} This is the TCL code that does this: set...
5
by: Eugene Anthony | last post by:
ds1.Tables.Rows.ItemArray.GetValue(0).ToString() contains the string path: images/5/Video1/qbert.flv if (File.Exists(ds1.Tables.Rows.ItemArray.GetValue(0).ToString())) { //code to execute } ...
0
by: cong | last post by:
web.xml: <?xml version="1.0" encoding="ISO-8859-1"?> <web-app> <display-name>ShowLifecycles</display-name> <description>An example of how to use lifecycle events</ description> <listener>...
4
by: rsaharia | last post by:
Hello All, I need help with this particular .pl file I picked up from http://www.veritools-usa.com/xnf2vhdl.htm What it's supposed to do is really convert an xnf file to a vhdl file. I need it for...
5
by: Arodicus | last post by:
I'm trying to get the pathname of the .js file that the currently-executing function resides in. This is useful if your .js file loads other assets within (or based on) the directory your .js file is...
4
by: Ty | last post by:
Hello all, I am creating a web site with Visual Stuido 2008. I am trying to use a java script file to create a busybox for login from this page http://blogs.crsw.com/mark/articles/642.aspx. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.