• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 171
  • Last Modified:

Using links in include files

I'm developing an ecommerce site that using a top menu bar for 'home, our stores, contact etc' and a side menu bar for departments - shoes, bags etc. I've put both nav menus into include files.

Firstly can someone tell me what I need to put in front of my links to make them absolute (ie. accessible from pages within subfolders).  

Secondly when the user gets to the check out page they are then transferred onto the secure server. If they then choose to continue shopping they need to go back to the original server in order for the cart details to still be there. On a previous site I made the links completely absolute ie, http://www.mysite.co.uk/shoes.php, which got me a round this problem, but is a pain when I'm editing on my testing server. Any suggestions ?
0
DallySP
Asked:
DallySP
  • 3
  • 2
1 Solution
 
CWS (haripriya)Commented:
if you want to access a file from a subfolder, use this:

include_once('../navmenu.php');
0
 
Cornelia YoderArtistCommented:
Another possibility, if you need to specify the full path due to the secure server, is to put the path itself in a single variable, and make all the rest of the code use it.

$includepath="http://www.mysite.co.uk/";

include_once ($path."shoes.php");

This will let you modify just one place when you are ready to move the code from your testing server to the secure server.
0
 
Cornelia YoderArtistCommented:
Er, that is ....

$includepath="http://www.mysite.co.uk/";

include_once ($includepath."shoes.php");
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
DallySPAuthor Commented:
Thats a good idea - I'll have a play with this and see if I can get it to work
0
 
DallySPAuthor Commented:
Sorted - what I did in the end was create a file called path.php which I've made relevant to both my testing site locally and my remote site. Then included the path file in my navigation include file. Lots of including includes - but works great on both servers. Thanks for your help.
0
 
Cornelia YoderArtistCommented:
Glad to help, good luck with your project :)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now