note 40934 added to function.dirname
| From: | zippywonderidiotatyahoodotcom at rn2 dot php dot net | Date: | Tue, 23 Mar 2004 19:40:57 +0000 |
| Subject: | note 40934 added to function.dirname | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67070@lists.php.net to get a copy of this message | ||
Andrew,
There are certainly good reasons to use relative includes, though I agree they usually should not be
used exclusively. Here's a couple of common situations:
1) You do not have control over the web server on which you're developing. If you want your
pages to work even if your {ISP,employer,friend,etc.} rearranges their server -- particularly
Apache's user_dir -- then relative includes are the way to go. Your pages will work if
they're at "http://www.host.tld/~user/", "http://host.tld/user/", or even "http://user.host.tld/".
2) You are developing a script or set of scripts for distribution. You don't want to force
your users to rearrange their web server to allow includes from /includes/my-files before they can
use your script, after all.
On my own server, for example, I keep all site-wide PHP and JavaScript in /scripts so that I
don't have to worry about where they're being called from. The include files used by my
media library, however, are in a scripts subdirectory of the folder the main script runs in. This
also makes development easier; the development and production versions simply reside in different
folders, allowing them to use different versions of the include files without altering the include
statements.
----
Manual Page -- http://www.php.net/manual/en/function.dirname.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40934
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40934&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40934&report=yes
Search -- http://master.php.net/manage/user-notes.php