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) Link to comment https://forums.phpfreaks.com/topic/88890-direct-linking/ 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 Link to comment https://forums.phpfreaks.com/topic/88890-direct-linking/#findComment-455333 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' ? Link to comment https://forums.phpfreaks.com/topic/88890-direct-linking/#findComment-455338 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.