RE: [PHP] Include path

From: Date: Fri, 23 Jul 2004 19:51:56 +0000
Subject: RE: [PHP] Include path
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-191684@lists.php.net to get a copy of this message
$baseDir = $_SERVER["DOCUMENT_ROOT"]; $templatesDir = $baseDir . "/templates/"; include($templatesDir . "header.php"); include($templatesDir . "body.php"); include($templatesDir . "footer.php"); > :-) > > Good solution, but the problem is once the program is > completed it goes out of my hands and most prolly the > client wont know the exact paths, the templates folder > would *always* be one below...but the path before the > /templates will change. > > Anyway, heres what I have come up with, comments are > welcome: > > $pieces = explode("/", $_SERVER["PATH_TRANSLATED"]); > $a=count($pieces); > $f=""; > for($i=1; $i < $a-2; $i++) > {$f=$f.$pieces[$i]."/";} > $include_path= "/".$f;

« previous php.general (#191684) next »