#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2015
    Posts
    3
    Rep Power
    0

    Making a centrally controlled navbar


    I know there is a way of doing this, but I don't remember how and can't seem to find an answer.
    I know you can control the way it's set up through the CSS sheet. But, I want to control the content, add an item or take one away without having to edit every page on the site.
    What kind of sheet do I use to do that?
  2. #2
  3. Code Monkey V. 0.9
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2005
    Location
    A Land Down Under
    Posts
    2,327
    Rep Power
    2063
    Using a server-side language (using PHP in this example):

    PHP Code:
    <?php require ('menu_file.php'); ?>
    There are other ways of doing this, but using a central menu file on your server is the easiest and lest-problematic way.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2015
    Posts
    3
    Rep Power
    0
    I've never done anything with php before, or any other server side language. I think I may have done this with JavaScript before, but it was long ago and far away. And a lot of what I used to think I knew, I need to re-learn.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2016
    Location
    Florida
    Posts
    3
    Rep Power
    0
    I understand how you feel. If you really like code, then you should have no problem learning everything you can about it. I'm always learning new techniques and languages. Trust me, PHP include/require statements are some of the easiest functions to implement. Simply put the code for your navigation in a file called "navigation.php" and then include it in your index.php wherever you want it to appear.

    PHP Code:
    <?php include("navigation.php"); ?>
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2015
    Posts
    3
    Rep Power
    0
    Ok, I'll give it a shot. It can't hurt to learn it, I guess.

IMN logo majestic logo threadwatch logo seochat tools logo