Hi, good day ...
I just want to ask how to extract a filename of the current document ? As of now, im building a php driven site and dont know how to extracty the filename of the current document im doing.
Here is the algorithm :
Example:
template.php - it will call an external php page called affad.php
affad.php - this will hold the code that will determine the category where the output appears base on the filename
My focus is how to extract the filename of the curent documant ...
Any help is deeply appreciated :
Thanks ...
How to Extract the filename of the current Document?
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
__FILE__ is literally, the file where that text appears. It sounds like you want to know what script was called by the client. Have a look through $_SERVER, since the fields filled varies slightly from server to server. Fields that can exist and will contain the filename are (but not limited to) SCRIPT_NAME, PHP_SELF, REQUEST_URI
If you just want the script of the corrent document, something like $_SERVER['PHP_SELF'] would suffice.
However if the document you want the URI of has a query string appended to it then you will need to request the query string from $_SERVER['QUERY_STRING'] and append it to the result of php_self
However if the document you want the URI of has a query string appended to it then you will need to request the query string from $_SERVER['QUERY_STRING'] and append it to the result of php_self
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
$_SERVER['REQUEST_URI'] does that for you.scrotaye wrote:If you just want the script of the corrent document, something like $_SERVER['PHP_SELF'] would suffice.
However if the document you want the URI of has a query string appended to it then you will need to request the query string from $_SERVER['QUERY_STRING'] and append it to the result of php_self
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.