| Welcome to WebmasterWorld Guest from 18.104.22.168 |
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
|$ SERVER function for file name|
| 7:24 am on May 24, 2012 (gmt 0)|
If you have mydomain.com/category/page.php
$_SERVER['SCRIPT_FILENAME'] gives you category/page.php
But is there something that gives you just page.php
If not how do you edit category/page.php or whatever it may be, e.g. category1/category2/page.php so it becomes only page.php?
| 8:22 am on May 24, 2012 (gmt 0)|
sorry worked it out:
$path = $_SERVER['SCRIPT_NAME'];
$newpath = basename($path);
$arr = explode(".", $newpath);
Is that the best way?
| 11:05 pm on Jun 1, 2012 (gmt 0)|
basename is what I would have suggested. There are optional parameters you can pass to the function as well, possibly saving you additional programming steps.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
© Webmaster World 1996-2014 all rights reserved