Say I have a script:
http://www.mydomain.com/test/admin/foo.php
That looks like this:
<?php
$baseDir = "http://" . $_SERVER[ "SERVER_NAME" ] . "/test";
require_once( $baseDir . '/helpers/helper.php' );
something();
?>
something() is a function in helper.php.
I get:
Call to undefined function: something() in
/home/mydomain/public_html/test/admin/foo.php on line 6
The require_once doesn't fail (well, I don't get an error message), so I'm
assuming that it finds helper.php OK. something() definitely exists in
helper.php.
If I put foo.php and helper.php in the same folder, lose all the $baseDir
crap and use require instead of require_once it works fine (not sure if it's
the $baseDir part or the require_once that is tripping it up), however I
need them to be in seperate folders and I'd rather use require_once than
require in case I end up including something twice by accident, it's so much
easier not to have to worry about it.
I've been fiddling with this for about an hour now and it's starting to get
really annoying.
Any ideas?
--
"Come to think of it, there are already a million monkeys on a million
typewriters, and the Usenet is NOTHING like Shakespeare!" - Blair Houghton
-=-=-=-=-=-=-=-=-=-=-=-
http://www.nrkn.com/
-=-=-=-=-=-=-=-=-=-=-=-