Interesting page refernce issues

The thing is Lets say I have my core files in a root and the admin panel in admin folder.

Now I use same sidebar for both.

The reference to certain files are now as follows

<a href="example.php"> example </a>

example.php is in the root, and the sidebar as created keeping that in mind first, now when the sidebar is now being used by the admin pages as well… that reference is trying to access something like this… where the real link is

I know I can put in direct link but that’s not good practice I know… What is the good solutions for this?


<a href="[COLOR="#FF0000"]/[/COLOR]example.php"> example </a>

Easy. :slight_smile:

okay thanks, that works when the files are in the root and a directory…

But does not work with directory and sub-directory. 2 level deep back to one level up.

now if the file is originally in and included in , and if I put ‘/’ in front of the page it takes to :frowning:

Your original question was how to get that link to point to example.php in the root directory from any location in the site. I gave you the answer to that.

If you are now wondering how to have a universal link to, then that would be this:

<a href="[COLOR="#FF0000"]/[/COLOR]members/file.php"> example </a>

The reason for putting the slash at the very front is that it tells the browser to start from the root folder, rather than from the current folder.


<a href="members/file.php"> example </a>

says “inside this folder, look for a folder called /members/ and then for a file in there called file.php”.


<a href="/file.php"> example </a>

says “go to the root folder and look for a file called file.php”.


<a href="[COLOR="#FF0000"]/[/COLOR]members/file.php"> example </a>

says “go to the root folder, look for a folder called /members/, and in there look for a file called file.php”.

Brilliant, Thanks!