Hi all

I'm reviewing a few things before starting a new project. I often need to include() a file relative to the current script which itself is included.

__FILE__ is useful to know the current script's path but it seems to be totally undocumented at php.net except for a few indirect references and user comments. Is it still current? I don't want to use something that might disappear soon but I haven't found any of the newer variables that do the same thing.

Unfortunately __FILE__ is difficult to search for on php.net because you end up seeing the result simply for 'file' which is not very helpful.

Perhaps my real question should be:

What is the cleanest and self-contained way to do a relative include from an included file which might not be in the same directory as its parent? A change in PHP 4.1 almost solved this but not quite. If it doesn't find the file in the include_path then it looks in the same directory as the current script. IMHO, its doing it in the wrong order. It would make more sense to check the currect directory first before trying the include_path. Putting a dot as the first element of the include_path doesn't fix it because the dot means the current directory of the top parent.

Cheers
Ross


_________________________________________________________________
MSN 8 with e-mail virus protection service: 3 months FREE*. http://join.msn.com/?page=features/virus&xAPID=42&PS=47575&PI=7324&DI=7474&SU= http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_eliminateviruses_3mf


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to