...

using include() from nested folders

brothercake
07-22-2002, 04:04 PM
I'm just going

<? include '/includes/file.php'; ?>


but it only works in the root directory. in the next directory I have to go

<? include '../includes/file.php'; ?>


Am I missing something here? I thought the preceding / meant start from root, like with images and js includes?

SYP}{ER
07-22-2002, 04:24 PM
I think for root you use ./

Otherwise, you could just use the complete URL while including:

include ("http://www.yourhost.com/blahblah/file.php");

Or I think this works, too:

include ($DOCUMENT_ROOT."/file.php"); // I saw this in the manual. Better test it.

brothercake
07-22-2002, 05:18 PM
thanks for those tips; I didn't wanna use the absolute because I want it to be easily moveable between local and remote servers.

Your second suggestion also only worked in the root directory, but it sent me along the right lines .. because the next thing i tried worked exactly as i wanted, this:

<? include $HTTP_SERVER_VARS["DOCUMENT_ROOT"] . '/includes/file.php'; ?>


cheers :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum