karldesign Posted February 1, 2008 Share Posted February 1, 2008 Hello all, I am creating a new website that I want to define constant links for. I have defined include locations but wanted to know if I could do similar with links: ie: $site_root_path = $_SERVER['DOCUMENT_ROOT']; include($site_root_path . '/includes/config.php'); include($site_root_path . '/includes/constants.php'); So, the links would work similarly? (eg: index.php, about.php, /events/index.php) Quote Link to comment Share on other sites More sharing options...
p2grace Posted February 1, 2008 Share Posted February 1, 2008 Are you looking for a constant? define("BASE_URL","http://www.acme.com/"); //Then you can call it by doing this: echo "<a href=\"".BASE_URL."\">here</a>"; Php.net http://us3.php.net/manual/en/function.define.php Quote Link to comment Share on other sites More sharing options...
karldesign Posted February 1, 2008 Author Share Posted February 1, 2008 I'm looking for the equivalent of $_SERVER['DOCUMENT_ROOT'] for linking, not including... or would I just use $site_root = 'http://www.domain.com' ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.