OAFC_Rob Posted June 15, 2011 Share Posted June 15, 2011 When I do the following; <?php echo $_SERVER['DOCUMENT_ROOT']."/innovationation1/commonResources/images/container/favicon.ico"; ?> I get output like this: C:/xampp/htdocs/innovationation1/commonResources/images/container/favicon.ico but when implement that like this, it doesn't bring up the fav.icon even tho the pathway is correct. <link rel="shortcut icon" href="<?php echo $_SERVER['DOCUMENT_ROOT'].'innovationation1/commonResources/images/container/favicon.ico'; ?>" /> Quote Link to comment https://forums.phpfreaks.com/topic/239448-can-someone-explain-this-pathway-issue/ Share on other sites More sharing options...
wildteen88 Posted June 15, 2011 Share Posted June 15, 2011 Because <?php echo $_SERVER['DOCUMENT_ROOT']."/innovationation1/commonResources/images/container/favicon.ico"; ?> is returning a file system path. Not a url. Remove $_SERVER['DOCUMENT_ROOT'] from that code. Quote Link to comment https://forums.phpfreaks.com/topic/239448-can-someone-explain-this-pathway-issue/#findComment-1230097 Share on other sites More sharing options...
redixx Posted June 15, 2011 Share Posted June 15, 2011 <link /> doesn't work with file system paths, it needs to be a URL. Quote Link to comment https://forums.phpfreaks.com/topic/239448-can-someone-explain-this-pathway-issue/#findComment-1230101 Share on other sites More sharing options...
OAFC_Rob Posted June 15, 2011 Author Share Posted June 15, 2011 Okay, so what would I use to keep the path way always going bck to the root folder, this would ideally help prevent pathway issues if folders and subfolders are used Quote Link to comment https://forums.phpfreaks.com/topic/239448-can-someone-explain-this-pathway-issue/#findComment-1230113 Share on other sites More sharing options...
redixx Posted June 15, 2011 Share Posted June 15, 2011 Make a base url constant with the URL to your root folder. define('BASEURL', 'http://example.com/'); <link rel="shortcut icon" href="<?php echo BASEURL.'innovationation1/commonResources/images/container/favicon.ico'; ?>" /> Quote Link to comment https://forums.phpfreaks.com/topic/239448-can-someone-explain-this-pathway-issue/#findComment-1230114 Share on other sites More sharing options...
wildteen88 Posted June 15, 2011 Share Posted June 15, 2011 Make a base url constant with the URL to your root folder. define('BASEURL', 'http://example.com/'); <link rel="shortcut icon" href="<?php echo BASEURL.'innovationation1/commonResources/images/container/favicon.ico'; ?>" /> or just start your urls with a / <link rel="shortcut icon" href="/innovationation1/commonResources/images/container/favicon.ico" /> Quote Link to comment https://forums.phpfreaks.com/topic/239448-can-someone-explain-this-pathway-issue/#findComment-1230121 Share on other sites More sharing options...
redixx Posted June 15, 2011 Share Posted June 15, 2011 Make a base url constant with the URL to your root folder. define('BASEURL', 'http://example.com/'); <link rel="shortcut icon" href="<?php echo BASEURL.'innovationation1/commonResources/images/container/favicon.ico'; ?>" /> or just start your urls with a / <link rel="shortcut icon" href="/innovationation1/commonResources/images/container/favicon.ico" /> Wouldn't that be relative to your current directory? Quote Link to comment https://forums.phpfreaks.com/topic/239448-can-someone-explain-this-pathway-issue/#findComment-1230123 Share on other sites More sharing options...
wildteen88 Posted June 15, 2011 Share Posted June 15, 2011 No, that is an absolute url. Its the same as your suggestion but without defining the website address. Quote Link to comment https://forums.phpfreaks.com/topic/239448-can-someone-explain-this-pathway-issue/#findComment-1230125 Share on other sites More sharing options...
OAFC_Rob Posted June 15, 2011 Author Share Posted June 15, 2011 Okay thank you just thought there was a built in function within PHP to say http://localhost/ without having to break it down to a base URL or hard code each URL ie /innovationation1/commonPages/about/aboutUs.php Quote Link to comment https://forums.phpfreaks.com/topic/239448-can-someone-explain-this-pathway-issue/#findComment-1230206 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.