darkfreaks Posted September 17, 2008 Share Posted September 17, 2008 ok guys my shopping cart isnt linking right and im pretty sure its not my code but my clients tech support says it is so i need a second opinion. ok for my image link code i have something like <?php $cat_image= WEB_ROOT . "images/category" . $cat_image; // path to image ?> which is the same as what they want the path to be /images/category/imagehere so i am abit confused as why it isnt linking correctly when i view it i get a link like mysite.com/hermes/59030939043/plaincart/category/image i am pretty sure this is a server problem right ??? Link to comment https://forums.phpfreaks.com/topic/124663-need-help-with-shop-cart/ Share on other sites More sharing options...
BlueSkyIS Posted September 17, 2008 Share Posted September 17, 2008 what does WEB_ROOT look like? try echoing it? if it's anything like $_SERVER['DOCUMENT_ROOT'], it is usually NOT what you want to put into an image path. Link to comment https://forums.phpfreaks.com/topic/124663-need-help-with-shop-cart/#findComment-643865 Share on other sites More sharing options...
darkfreaks Posted September 17, 2008 Author Share Posted September 17, 2008 yeah i read an article where someone had the same problem they said web_root wasnt a good idea even if you used define. so i think im going to drop WEB_WOOT and put ../ you think that would work ??? Link to comment https://forums.phpfreaks.com/topic/124663-need-help-with-shop-cart/#findComment-643882 Share on other sites More sharing options...
BlueSkyIS Posted September 17, 2008 Share Posted September 17, 2008 what does WEB_ROOT look like? try echoing it? if the images are in /images, just use /images. Link to comment https://forums.phpfreaks.com/topic/124663-need-help-with-shop-cart/#findComment-643885 Share on other sites More sharing options...
darkfreaks Posted September 17, 2008 Author Share Posted September 17, 2008 okay i found where they define webroot ill paste the code' <?php $thisFile = str_replace('\\', '/', __FILE__); $docRoot = $_SERVER['DOCUMENT_ROOT']; $webRoot = str_replace(array($docRoot, 'library/config.php'), '', $thisFile); $srvRoot = str_replace('library/config.php', '', $thisFile); define('WEB_ROOT', $webRoot); define('SRV_ROOT', $srvRoot); ?> Link to comment https://forums.phpfreaks.com/topic/124663-need-help-with-shop-cart/#findComment-643890 Share on other sites More sharing options...
BlueSkyIS Posted September 17, 2008 Share Posted September 17, 2008 if the images are in /images, just use /images. Link to comment https://forums.phpfreaks.com/topic/124663-need-help-with-shop-cart/#findComment-643894 Share on other sites More sharing options...
darkfreaks Posted September 17, 2008 Author Share Posted September 17, 2008 so should i remove the define WEB_ROOT stuff and recode the whole thing to the direct path ??? Link to comment https://forums.phpfreaks.com/topic/124663-need-help-with-shop-cart/#findComment-643896 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.