Re: Name of page itself? [message #177216 is a reply to message #177213] |
Tue, 28 February 2012 10:23 |
crankypuss
Messages: 147 Registered: March 2011
Karma:
|
Senior Member |
|
|
On 02/28/2012 02:58 AM, Sonnich Jensen wrote:
> Hi
>
> 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?
>
> Sonnich
There is really no way to answer that question in an absolute sense, for
example the "main page" for my web code is "index.php" and *everything*
goes through that.
If you're working with the usual stuff out of the box, you can use
phpinfo() to see which variable you'd like to use to figure out what
you're dealing with... look at things like $_SERVER["DOCUMENT_ROOT"],
$_SERVER["SCRIPT_FILENAME"], $_SERVER["SCRIPT_NAME"],
$_SERVER["PHP_SELF"] for starters.
|
|
|