Kookedoh Posted October 20, 2009 Share Posted October 20, 2009 hey all thanks in advance for the help, ok im pretty new to this and have just created a shopping cart system, with a feature for admin to log in and add new items, but im having a problem when i click links within this section or example http://localhost/admin/ when i put that in URL bar works fine but when im in and view something else IE product i get 404'd and this in the URL http://localhost/admin/admin/product/ where as i want it to be http://localhost/admin/product/ any ideas whould be hugely appreciated tahnks agen Quote Link to comment https://forums.phpfreaks.com/topic/178383-returning-to-root-dir/ Share on other sites More sharing options...
abazoskib Posted October 20, 2009 Share Posted October 20, 2009 post the code where you assign those links Quote Link to comment https://forums.phpfreaks.com/topic/178383-returning-to-root-dir/#findComment-940710 Share on other sites More sharing options...
mikesta707 Posted October 20, 2009 Share Posted October 20, 2009 <a href="<?php echo $_SERVER['DOCUMENT_ROOT']; ?>/admin"> admin</a> $server['document_root'] has the address of the root directory in your server. I don't remember if the value comes with a slash at the end or not, so you may have to get rid of that slash Quote Link to comment https://forums.phpfreaks.com/topic/178383-returning-to-root-dir/#findComment-940711 Share on other sites More sharing options...
Daniel0 Posted October 20, 2009 Share Posted October 20, 2009 <a href="<?php echo $_SERVER['DOCUMENT_ROOT']; ?>/admin"> admin</a> $server['document_root'] has the address of the root directory in your server. I don't remember if the value comes with a slash at the end or not, so you may have to get rid of that slash That won't work. $_SERVER['DOCUMENT_ROOT'] contains the path to the document root on the filesystem Quote Link to comment https://forums.phpfreaks.com/topic/178383-returning-to-root-dir/#findComment-940724 Share on other sites More sharing options...
mikesta707 Posted October 20, 2009 Share Posted October 20, 2009 Ahh yeah my bad, try using $_SERVER["HTTP_HOST"] instead. that will give you your domain name, IE www.example.com/ Quote Link to comment https://forums.phpfreaks.com/topic/178383-returning-to-root-dir/#findComment-940748 Share on other sites More sharing options...
Kookedoh Posted October 21, 2009 Author Share Posted October 21, 2009 ok i use a template php to display all pages in the admin section which contains all my links hope this is what you wanna see: <?php if (!defined('WEB_ROOT')) { exit; } $self = WEB_ROOT . 'admin/index.php'; ?> <html> <head> <title><?php echo $pageTitle; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="<?php echo WEB_ROOT;?>admin/include/admin.css" rel="stylesheet" type="text/css"> <script language="JavaScript" type="text/javascript" src="<?php echo WEB_ROOT;?>library/common.js"></script> <?php $n = count($script); for ($i = 0; $i < $n; $i++) { if ($script[$i] != '') { echo '<script language="JavaScript" type="text/javascript" src="' . WEB_ROOT. 'admin/library/' . $script[$i]. '"></script>'; } } ?> </head> <body> <table width="750" border="0" align="center" cellpadding="0" cellspacing="1" class="graybox"> <tr> <td colspan="2"><img src="<?php echo WEB_ROOT; ?>admin/include/banner-top.gif" width="750" height="75"></td> </tr> <tr> <td width="150" valign="top" class="navArea"><p> </p> <a href="<?php echo WEB_ROOT; ?>admin/" class="leftnav">Home</a> <a href="<?php echo WEB_ROOT; ?>admin/category/" class="leftnav">Category</a> <a href="<?php echo WEB_ROOT; ?>admin/product/" class="leftnav">Product</a> <a href="<?php echo WEB_ROOT; ?>admin/order/?status=Paid" class="leftnav">Order</a> <a href="<?php echo WEB_ROOT; ?>admin/config/" class="leftnav">Shop Config</a> <a href="<?php echo WEB_ROOT; ?>admin/user/" class="leftnav">User</a> <a href="<?php echo $self; ?>?logout" class="leftnav">Logout</a> <p> </p> <p> </p> <p> </p> <p> </p></td> <td width="600" valign="top" class="contentArea"><table width="100%" border="0" cellspacing="0" cellpadding="20"> <tr> <td> <?php require_once $content; ?> </td> </tr> </table></td> </tr> </table> <p> </p> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/178383-returning-to-root-dir/#findComment-941074 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.