Daniel Brown wrote:
On Fri, Mar 6, 2009 at 08:53, Stuart <stuttle@xxxxxxxxx> wrote:
1.) We use regular open tags to be compatible with all stock
PHP configurations.
2.) We echo out the response from dirname() so that it's
output to the HTML source.
3.) We use dirname() twice, so it gives the dirname() of the
dirname(), rather than '..'.
4.) There are double underscores around FILE. The same is
true with LINE, FUNCTION, etc.
5.) dirname() gives you the full path on disk, not the URL. Usually you can
just remove the document root path to get the URL. This could be in
$_SERVER['DOCUMENT_ROOT'] but you can't rely on that between servers or when
the config changes.
6.) When used in conjunction with realpath()[1], it will
resolve the absolute local pathname.
^1: http://php.net/realpath
that's the way i do it, for example
require_once realpath( dirname(__FILE__) . '/lib/LibAllTests.php' );
also I often use set_include_path to ensure everything works throughout,
it's a lot simpler for require/includes
set_include_path( get_include_path() . PATH_SEPARATOR . realpath(
dirname(__FILE__) . DIRECTORY_SEPARATOR ) );
for example.. then all subsequent requires will be:
require_once 'Folder/file.php';
regards
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php