note 94083 rejected from reserved.variables.server by danbrown
| From: | danbrown@php.net | Date: | Thu, 15 Oct 2009 15:51:00 +0000 |
| Subject: | note 94083 rejected from reserved.variables.server by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161772@lists.php.net to get a copy of this message | ||
Note Submitter: cj dot wijtmans at gmail dot com
----
Hello php community.
I am using apache rewrite to turn php url's into simple urls. In my system i had problems
including CSS/JS/img since the search path for "127.0.0.1/news/3" is different than
"127.0.0.1/?page=newsitem&newsid=3".
so i wrote this rather inefficient solution:
[code] self::$path = './';
$path = str_replace(str_replace('\\', '/',
dirname(dirname(__DIR__)).'/'), '',
$_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI']);
$c = explode('/', $path);
while(next($c) !== false)
self::$path .= '../';[/code]
If anyone can improve this code will be welcome. And it must take account of windows using \ instead
of /.
Greets CJ.