note 70709 modified in function.dirname by danbrown

From: Date: Sun, 20 Jul 2008 19:03:01 +0000
Subject: note 70709 modified in function.dirname by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142258@lists.php.net to get a copy of this message
Getting absolute path of the current script: <?php dirname(__FILE__) ?> Getting webserver relative path of the current script... <?php function GetRelativePath($path) { $npath = str_replace('\\', '/', $path); return str_replace(GetVar('DOCUMENT_ROOT'), '', $npath); } ?> later on <?php GetRelativePath(dirname(__FILE__)); ?> If anyone has a better way, get to the constructive critisism! --was-- Getting absolute path of the current script: dirname(__FILE__) Getting webserver relative path of the current script... function GetRelativePath($path) { $npath = str_replace('\\', '/', $path); return str_replace(GetVar('DOCUMENT_ROOT'), '', $npath); } later on GetRelativePath(dirname(__FILE__)); If anyone has a better way, get to the constructive critisism! http://php.net/manual/en/function.dirname.php

« previous php.notes (#142258) next »