View Single Post
Old 04-09-2008, 02:49 AM   #2 (permalink)
delayedinsanity
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

I wish I could remember who it was who suggest this, so I could give them credit, but have you tried using $_SERVER['DOCUMENT_ROOT']? I've started to employ this between my test machine and my remote server and it works quite well. Say if you're local is a windows box, and the document root is C:\my documents\htdocs, and your remote is linux, and it's /www/public_html, using document root, you never have to worry about relative paths, you just

include($_SERVER['DOCUMENT_ROOT'] . "/path/to/include.php");

It's just like using

include("C:\my documents\htdocs\path\to\include.php"); or
include("/www/public_html/path/to/include.php");

except that since you're calling the _SERVER array it will automagically fill in the root based on whatever machine you may transfer the script to.
-m
delayedinsanity is offline  
Reply With Quote