Govinda wrote:
I want something that will work for calling an include from any file
that
lives n levels deep.
That's where you have to define a variable (or constant) that
tells the system where the web root is located, and then use that to
determine where you are in relation to that. For
On Sun, 5 Jul 2009 14:33:07 -0600
Govinda govinda.webdnat...@gmail.com wrote:
I am confusing myself reading the docs just now.
i.e.:
include_path
basename()
and dirname()
I had thought from many months ago that
?php include '/somedir/somefile.php'; ?
would include
somefile.php
On Jul 5, 2009, at 4:42 PM, Kim N. Lesmer wrote:
Like Michael said there is more than one way to deal with this.
I personally prefer to use this:
require_once ($_SERVER['DOCUMENT_ROOT'] . /incl/myfile.php);
Unless the file needs to be kept outside of where the webserver serves
files.
Kim,
On Mon, Jul 6, 2009 at 11:04, Govindagovinda.webdnat...@gmail.com wrote:
Kim, this is exactly what I was looking for. I had been over $_SERVER in
the docs.. but somehow missed that basic obvious param. Thanks!
And now I'll throw a monkey wrench into the gears and tell you
that, yes, it
On Mon, Jul 6, 2009 at 8:24 AM, Daniel Brownparas...@gmail.com wrote:
Conversely, using the code example from above (and building upon
it), we know that __FILE__ remains static regardless of the point of
the call. Thus, it's a better and more reliable method, and is usable
even if
On Jul 6, 2009, at 9:24 AM, Daniel Brown wrote:
On Mon, Jul 6, 2009 at 11:04, Govindagovinda.webdnat...@gmail.com
wrote:
Kim, this is exactly what I was looking for. I had been over
$_SERVER in
the docs.. but somehow missed that basic obvious param. Thanks!
And now I'll throw a
On Mon, 6 Jul 2009 16:16:55 -0600
Govinda govinda.webdnat...@gmail.com wrote:
I do not really understand why
$_SERVER['DOCUMENT_ROOT']
should return the right data at one time and not at another. (?)
In general it will always provide the right data, but as the manual
says: The entries in
On Mon, Jul 6, 2009 at 18:16, Govindagovinda.webdnat...@gmail.com wrote:
this is great, but then I still do not have a solution that will work for
any level deep of dir/ .
I.e. this-
dirname(dirname(__FILE__))
gives the correct first part of the path to document root like
I want something that will work for calling an include from any
file that
lives n levels deep.
That's where you have to define a variable (or constant) that
tells the system where the web root is located, and then use that to
determine where you are in relation to that. For example:
?php
On Mon, Jul 06, 2009 at 07:15:03PM -0600, Govinda wrote:
snip
Dan I love to see smart hacks in action! ..and I believe I get what
you are doing.
I am just amazed that there is not a SIMPLE (one-liner) reliable way
of just saying document root without a complex function like that.
I mean
I'm not sure how this could be made simpler.
$site_root = realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR;
Call that in any file in the root of *your* web directories, and you
have what is essentially the document root for *your* site.
Presumably, you know the *relative* directories of all
I am confusing myself reading the docs just now.
i.e.:
include_path
basename()
and dirname()
I had thought from many months ago that
?php include '/somedir/somefile.php'; ?
would include
somefile.php
living in
somedir
regardless from where in the site structure I am calling it.
Now it does
12 matches
Mail list logo