FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Name of page itself?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Name of page itself? [message #177248 is a reply to message #177213] Thu, 01 March 2012 15:23 Go to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Tue, 28 Feb 2012 01:58:03 -0800, Sonnich Jensen wrote:

> I have not worked with PHP for 2+ years, now again and need to refill my
> brain...
>
> How can I get the name of the main page?
>
> Say, index.php includes menu.php, how do I get the name of the main
> page, in this case index.php?
> Next say page1.php, page2.php etc?

I'm not sure quite what you mean.

Do you (a) just want the trailing filename, or do you want the trailing
filename relative to some arbitrary point in (b) the local file
structure, or (c) an http request url?

The reason I ask is twofold:

1) You don't clarify whether you expect filenames in sub directories to
include path information or not. I could assume you do, I could assume
you don't, instead I choose to confirm your expectation in such
circumstances.

2) If you do expect path information, then although for "http://host/
file" where "file" is at "<docroot>/file", "file" will generally be the
same for a, b and c, and in many webservers this is probably the case,
there are probably also many webservers where due to directory aliasing
in the server, or the use of links (is shortcuts what Ms calls them?) in
the file system and directory structure, or for some other reason, the
filename, the "path+file" url components and the actual filesystem
location of the file (whether absolute or relative to some arbitrary
point) may bear no obvious relationship whatsoever to each other.

Hence, although I see many answers in this thread that address a flat
single directory situation, I'm not 100% sure, partly because I'm not
sure what you actually expect in such cases, that they will give the
answers you expect in every situation in which you might conceivably
deploy them.

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: MAX(id)
Next Topic: string to array
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 22:31:42 GMT 2024

Total time taken to generate the page: 0.05763 seconds