Jump to content

Recommended Posts

ive not tried the full root yet no, i want it relative to the site and to include it on all pages;

and ive tried include('../member_header.php'); to no avail.

 

can i just ask the .. tells the browser to look a directory abouve the current page?

 

sorry if my wording seems all mumble jumble and thanks!

Yes ../ is to go one level higher. To go down a level you specify the directory in the current level.

 

However I highly suggest PFMaBiSmAd's comment.

 

When using include's always do

include $_SERVER['DOCUMENT_ROOT'] . 'path/to/file.php'

This eliminates the need to use ../ in your paths. PHP will locate files from your websites root folder (where you upload your sites files to).

And even though you got it working where the main file is located now, if you should move the main file up or down a level or reuse that code in a different folder structure, it will stop and you will need to go back and figure out a new relative path.

 

Forming an absolute file system path using DOCUMENT_ROOT will allow the include() statement to work no matter what folder the file is in.

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.