thetick Posted March 22, 2010 Share Posted March 22, 2010 I have recently downloaded a shopping cart script from www.phpwebcommerce.com and I have runned into some problems. This is where the problem is: config.php FILE: // setting up the web root and server root for // this shopping cart application $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); and this is how a tipical link would look like: <a href="<?php echo WEB_ROOT; ?>admin/" class="leftnav">Home</a> Now this script works great in my localhost, however, when I go on a live server all of my links look like this: http://markekong.hostzi.com/home/a8738962/public_html/admin/category/ when they should look like this: http://markekong.hostzi.com/admin/category/ I have tried to find out what the problem is by echoing some variables in my config.php file, something like this: <?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); echo $thisFile . ' : thisfile variable<br>'; echo $docRoot . ' :docRoot variable<br>'; echo $webRoot . ' : webRoot variable<br>'; echo $srvRoot . ' : srvRoot variable<br>'; ?> And I get these results: On localhost: C:/xampp/htdocs/aa.php : thisfile variable C:/xampp/htdocs :docRoot variable /aa.php : webRoot variable C:/xampp/htdocs/aa.php : srvRoot variable On Webserver: /home/a8738962/public_html/aa.php : thisfile variable /usr/local/apache/htdocs :docRoot variable /home/a8738962/public_html/aa.php : webRoot variable /home/a8738962/public_html/aa.php : srvRoot variable Any one have any ideas ? Link to comment https://forums.phpfreaks.com/topic/196115-little-help-with-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.