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… www.website.com/admin/example.php where the real link is www.website.com/example.php

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

tx

<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.

example.com/members
example.com/members/admin

now if the file is originally in example.com/members and included in example.com/members/admin , and if I put ‘/’ in front of the page it takes

example.com/members/file.php to example.com/file.php :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 example.com/members/file.php, 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.

This

<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”.

This

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

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

This

<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!