Jump to content

Little Help With script


thetick

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.