Re: including above current directory
| From: | Richard Lynch | Date: | Mon, 12 May 2003 08:32:23 +0000 |
| Subject: | Re: including above current directory | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-147273@lists.php.net to get a copy of this message | ||
Mike Mannakee wrote:
Possibly a stupid question, but how do I reference a directory a level above the current file in a hierarchy, in an include statement? Or two levels? Before you ask, I'm not talking about going above the document root, just a folder or two up.Others have given you the concrete answers. I'll give you an abstract one: "Don't do that." :-) Every developer I've ever seen do this (obligatory note that there must be some exception somewhere) has lived to regret it. Sooner or later you'll want to move one file or another and all your relative references will be all screwed up. Fix your include_path in .htaccess or httpd.conf (if you have access to it) and don't muck around with relative paths in include files. The hair you save may be your own. :-) If you really really need to have multiple files with same name in different directories getting included (ugh!) then use a full path right in your include statement. That's probably also bad design, but not EVERY time like relative includes is.