Hi there, PHP newbie here. How do I define a global variable to point to the root of a web site so that I can navigate from anywhere to anywhere, without having to specify it (i.e. PHP works it out For example: <?php global siteRoot = "the website's URL" ?> PHP: Where siteRoot Code (markup): for example would pick up http://forums.digitalpoint.com it was running on this site. I want to be able to write code like: include_once $siteRoot."\includes\sub\sub\file.inc" Code (markup): for example. Unless I'm missing can't see this in PHPINFO() Is there an easy way ?
PHP has this... include_once $_SERVER['DOCUMENT_ROOT']."\includes\sub\sub\file.inc" PHP: http://www.php.net/reserved.variables
No problem. And global variables are generally frowned upon, so I would start right now coding without them. -Peter