Re: included_by() possible?

From: Date: Fri, 25 Aug 2000 07:37:04 +0000
Subject: Re: included_by() possible?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-30592@lists.php.net to get a copy of this message
On Fri, 25 Aug 2000, André Langhorst wrote: > I wonder if it *could* be possible to dertmine which file > included a file. If this is possible I´ll post a feature/request. > It´s a bit annoying that I´ll have to set a variable each time, > when I want the included file to know which is the include()ing file. > > eg. > > --- filea.php --- > include('fileb.php'); > > --- fileb.php --- > echo included_by(); // output 'fileb.php' or similar > > CURRENTLY, it´s only possible this way > > --- filea.php --- > $origin=__FILE__; > include('fileb.php'); > > --- fileb.php --- > echo $origin; > > > You´ll ask, why do you want to save this single line? > Well, for end-user satisfaction. If a user wants to user one > of my applications embedded in his own page, then it´d be best > if the user just had to do > > <STUFF>aölsdkfaölsdkjf</STUFF> > <OTHER>aösldkfjalskdjfa</OTHER> > <?php include('my.application.php'); ?> > > just like a nice component you plug into a page, no variables > no constants, no function calls, just a single include instruction. The main question is why an include file needs to know which file included it. - Sascha

« previous php.dev (#30592) next »