For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > July 2004 > Re: Frustrated with PHP's "include"









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Frustrated with PHP's "include"
Žed Eye Media - Richard Grove

2004-07-26, 8:57 am


"steve" <UseLinkToEmail@dbForumz.com> wrote in message
news:10g5ct6bktt76bd@news.supernews.com...
> I am quite frustrated with php's include, as I have spent a ton of
> time on it already... anyone can tell me why it was designed like this
> (or something I don't get)?
>
> The path in include is relative NOT to the immediate script that is
> including it, but is relative to the top-level calling script.
>
> In practice, this means that you have to constantly worry and adjust
> paths in includes, based on the startup scripts that call these
> lower-level scripts.
>
> Why is the include path not simply relative to the script that is
> immediately including?
>
> --
> http://www.dbForumz.com/ This article was posted by author's request
> Articles individually checked for conformance to usenet standards
> Topic URL:

http://www.dbForumz.com/PHP-Frustra...pict132935.html
> Visit Topic URL to contact author (reg. req'd). Report abuse:

http://www.dbForumz.com/eform.php?p=443884



I use a little script that looks for the include folder and then creates a
$incdir variable.
This is then used in each script.

include_once("$incdir/databaseconnectionorsomething.php");

Regards
Richard Grove



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com