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"
Chung Leong

2004-07-24, 8:55 pm

"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

As I've explained before, it's because include/require in PHP4 is a runtime
operation.

See earlier thread:

http://groups.google.com/groups?hl=...ernys
hev

sky%40hotmail.com%26ie%3DUTF-8%26hl%3Den


steve

2004-07-25, 3:55 am

"Chung Leong" wrote:
> "steve" <UseLinkToEmail@dbForumz.com> wrote in message
> news:10g5ct6bktt76bd@news.supernews.com...
> of
> this
> is
> adjust
> author’s request
> http://www.dbForumz.com/PHP-Frustra...pict132935.html
> abuse:
> http://www.dbForumz.com/eform.php?p=443884
>
> As I’ve explained before, it’s because include/require in
> PHP4 is a runtime
> operation.
>
> See earlier thread:
>
> http://groups.google.com/groups?hl=...ernys
hev

> sky%40hotmail.com%26ie%3DUTF-8%26hl%3Den


Chung, thanks for the link. I visited the thread, and it is obviously
a concern with others as well!

I quote you:
----------------------------
The fact that it’s an runtime operation makes a big difference.
Suppose I
write a function that include a file:

function CustomInclude($path) {
include($path);
echo "<!-- including $path -->";
}

And suppose I place this function in
/chung/utilities/useless/functions.php.
When I pass a relative path to this function in some project, I
certainly
wouldn’t want the path to be relative to the file containing the
function.
---------------------------

Can you explain the above. I am having a hard time with it. The main
argument was about why php designers did it this way, and that is my
focus. You are saying that it had to be done this way.

--
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=444024
Sponsored Links







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

Copyright 2008 codecomments.com