[thelist] PHP, include() and relative links

Peter Van Dijck peter at vardus.com
Fri May 25 12:15:52 CDT 2001

>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.


What I always do is define the path
define (PATHTOROOT, "/www/server/htdocs/");
and then do all includes like this:
include (PATHTOROOT . "/file/template.php");

Again, the path depends on your provider. You can probably find it out by 
FTP-ing and see what directories you get there before the htdocs publicly 
viewable one.
http://liga1.com building multiple language/culture websites
http://poorbuthappy.editthispage.com online ethnology, up&down

More information about the thelist mailing list