Jump to content

[SOLVED] dynamic nav bar


thefortrees

Recommended Posts

Hi all -

 

I am trying to implement a dynamic navigation bar. My problem is as follows -

 

All of my scripts are located in various folders, and as you move to different areas of the site, the links to the other areas of the site will change. For example, I am currently at home.php and the nav bar has references to admin/manage_users.php and companies/view_employees.php, etc etc. If I go to manage_users.php, I am now executing a script in the admin folder. The nav bar still has a reference to companies/view_employees.php, which would make this a dead link.

 

There are lots and lots of directories and subdirectories that one can navigate to, so I don't want to have to write code for a nav bar every time. Is there something like $_SERVER['DOCUMENT_ROOT'] that I can use that will help?

Link to comment
Share on other sites

There is:

dirname(__FILE__);

 

That shows like /home/user/www/folder1/folder2/

 

What I did was, even though my PHP files are in a different folder I did:

$path = dirname(__FILE__);

include $path."/php/admin/head.php";

 

Hope it helps.

 

Link to comment
Share on other sites

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.