site root variable (for Generic Unix and Windows)

From: Date: Mon, 19 Mar 2001 13:10:03 +0000
Subject: site root variable (for Generic Unix and Windows)
Groups: php.general 
Request: Send a blank email to php-general+get-44533@lists.php.net to get a copy of this message
I am developing a PHP site under windows which is going to be deployed eventually on Unix (indeed when life gets less hectic will also be developed under Unix but that's another story). Anyway the header.html (included at top of every page) has links in it. However depending where the page is which is including header.html the links (from a relative point of view) will be different. For example for the index.php (which is in site root) the catalogue page is simply referred to as cat.html but from admin.html (which is in the admin directory under site root) ../cat.html would be required. A way to get round this problem seems to be to have a variable with the site root in it (i.e. $siteroot = "c:/pages/") however this is causing me a real headache. using echo "<a href=\"" . $siteroot "/cat.php">Catalogue</a> renders href to c:/pages/cat.php but then the browser tries to download the page as a file. I have also tried $siteroot = "http://green/ (green being the domain) but this douse not work either. I would really like the solution to this to be platform independent. Ta in Advance, ben -- ben.2.edwards@bt.com (ben@work until end March) ben@videonetwork.org (ben@home)

« previous php.general (#44533) next »