473,326 Members | 2,337 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,326 software developers and data experts.

using __FILE__

Hi everyone,

I want to create a script that will determine where in an array or
database to find information based on the name of the file. I have
the reference working, but it's giving me too much information.

<?
$f = __FILE__;
print $f
?>

gives me

/home/calador/public_html/wapolitics/counties/adams.php

All I want is "adams".

Any ideas?

Chad Lupkes
ch********@earthlink.net
Jul 17 '05 #1
6 9468
On 22 Nov 2003 16:21:04 -0800, Chad Lupkes wrote:
Hi everyone,

I want to create a script that will determine where in an array or
database to find information based on the name of the file. I have
the reference working, but it's giving me too much information.

<?
$f = __FILE__;
print $f
?>

gives me

/home/calador/public_html/wapolitics/counties/adams.php

All I want is "adams".

Any ideas?

Chad Lupkes
ch********@earthlink.net


All your basename() are quite helpful in this instance...

For more information:
http://us4.php.net/manual/en/function.basename.php

--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Jul 17 '05 #2
I noticed that Message-ID: <np******************************@40tude.net>
from FLEB contained the following:
All your basename() are quite helpful in this instance...

All your basename() are belong to us...
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #3
Hi Rudy,

I found that, and it helped. I just posted another question about arrays as
a follow up.

Thanks!

--
Chad Lupkes
ch********@yahoo.com
http://www.seattlewebcrafters.com/
"FLEB" <so*********@mmers.and.evil.ones.will.bow-down-to.us> wrote in
message news:np******************************@40tude.net.. .
On 22 Nov 2003 16:21:04 -0800, Chad Lupkes wrote:
Hi everyone,

I want to create a script that will determine where in an array or
database to find information based on the name of the file. I have
the reference working, but it's giving me too much information.

<?
$f = __FILE__;
print $f
?>

gives me

/home/calador/public_html/wapolitics/counties/adams.php

All I want is "adams".

Any ideas?

Chad Lupkes
ch********@earthlink.net


All your basename() are quite helpful in this instance...

For more information:
http://us4.php.net/manual/en/function.basename.php

--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.543 / Virus Database: 337 - Release Date: 11/21/2003
Jul 17 '05 #4
> All your basename() are belong to us...

HAH. I was thinking the same thing! :)
Jul 17 '05 #5
Regarding this well-known quote, often attributed to timmeh's famous "Sun,
23 Nov 2003 06:01:47 GMT" speech:
All your basename() are belong to us...


HAH. I was thinking the same thing! :)

Um... that was the pun :)

--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Jul 17 '05 #6
I noticed that Message-ID:
<1m*******************************@40tude.net> from FLEB contained the
following:
All your basename() are belong to us...


HAH. I was thinking the same thing! :)

Um... that was the pun :)


Oops.<blush>

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #7

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

Similar topics

0
by: Chris Pomasl | last post by:
We picked up a helpdesk script from sourceforge, Mantis. This script uses the __FILE__ magic constant to ostensibly derive the path to the include directory from a script in the top level...
1
by: Chris Pomasl | last post by:
Does no one have any insight?......please? Chris -------- Original Message -------- Subject: Problem with __FILE__ magic constant Date: Tue, 06 Jan 2004 16:43:41 GMT From: Chris Pomasl...
1
by: Spry | last post by:
Hi, I wanted to write macros for finding the number of memory allocations and deallocations also wanted to find the locations. The code I have is a pretty big one. I have a wrapper on top of...
5
by: baumann.Pan | last post by:
where are these macros defined? can I use it a release ver code?
5
by: spike grobstein | last post by:
So, I've got this project I'm working on where the app defines various classes that are subclassed by module packages that act like plugins... I'd like the packages to define a file path for...
2
by: fortepianissimo | last post by:
This is a question to all of you who use Komodo IDE for development: when I tried to debug my script which uses __file__ to get the absolute path to the file, Komodo complained that the variable is...
18
by: Lukas Ruf | last post by:
Dear all, for debugging purposes, I like the pre-compiler macros __FILE__, __FUNCTION__, __LINE__ I have been wondering if there is a short form of __FILE__ that provides only the filename...
3
by: mh | last post by:
So on most modules I import, I can access the .__file__ attribute to find the implementation. ie: >>> import time >>> time.__file__ '/data1/virtualpython/lib/python2.3/lib-dynload/timemodule.so'...
4
by: 7stud | last post by:
Hi, I'm having trouble understanding what the definition of __file__ is. With this program: ------ #data.py: def show(): print __file__
4
by: allan.mcrae | last post by:
As part of a very simple memory leak detector, I am trying to store the value of __FILE__ in a char*. Since gcc4.2 I get the following warning... warning: deprecated conversion from string...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.