Hello,

Just imagine you had just copied the file you want to include and then
pasted it into the master file.
PHP does not any path translation. For example if you have the following
structure:
- /
-- a.php
-- b.php
-- /utils
---- c.php
---- d.php

Let c.php is included in a.php.
Then if you want to include d.php in c.php you should use "include
utils/d.php". Obviously if you want to include b.php inside c.php just
"include b.php" is pretty enough.

I have many times thought that the inclusion mechanism could sometimes be
not only confusing, but also unhandy for use in larger libraries. In order
to be your package easy deployable usually you go through inventing your own
constant-based path translation system.
Unfortunately my reflections on the subject of the inclusion system
improvements have never been much fruitful....

Regards,
Nikolay

On Friday, April 23, 2004 2:27 AM Richard Harb <[EMAIL PROTECTED]> wrote:


> did you check the online manual for those funcitons yet?
>
> I have found the user notes to be a wealthy ressource on that matter.
>
> This topic also came up very recently on this list so checking the
> archives might solve it.
>
> Richard
>
>
> Thursday, April 22, 2004, 10:34:23 PM, thus was written:
> > Hi,
> > I have problem in undertanding the
> > require_once/require/include/include_once
> > functionality. Php files in my project are located in different folders.
> > Some folders have common files for other files. And file layout is like
this
>
> > /*
> >     File: a.php
> > */
> > require_once('../test/db.php');
> > ...
>
>
> > /*
> > File: db.php
> > */
> > require_once('../globals/global.php');
> > ...
>
>
> > when i include a.php in another file i get error for global.php file
that
> > path could not be found. And if i correct the path in db.php then
someother
> > file which is using db.php will get error. So, can someone elaborate
that
> > how relative path works in require_once. what is the starting directory
for
> > require_once function which is using relative path.
>
> > Or
>
> > Is there any way that i can included some constant which include the
> > absolute path from which all relative paths can be determined?
>
> > Comments welcome.
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to