[thelist] PHP, include() and relative links

Bob Davis bobd at members.evolt.org
Fri May 25 12:56:33 CDT 2001


On Friday, May 25, 2001, at 12:40 PM, Peter Stansfield wrote:

> I want to be able to include a file called template.php located in a 
> files
> directory. I want this file to be included by several different files 
> held
> in different directories. I thought this could be acheived using
> include("/file/template.php") but it doesn't seem to want to work.
>
> Please could someone show me the error of my ways.

I've used this:

<?
	include($DOCUMENT_ROOT."/file/template.php")
?>

The thing is that PHP sees the root of the site differently than the 
server does. It looks at the absolute path on the server, and not the 
root as defined in, say, Apache.

bob

--
bob davis
bobd at members.evolt.org




More information about the thelist mailing list