Menu creation with php

Discussion in 'PHP' started by OreoKnight, Feb 15, 2008.

  1. #1
    I was wondering if it where possible to create a complete navigation system with php that loads on each page seperatly. Sort of like style sheets but with actual coding. This way I don't have to redo the nav links everytime, just the .php file I have them in. Is it as simple as creating the links in say a nav.php and then somehow getting a command in to open that menu? If so what would that code be. I've tried looking it up and have failed to find something really useful so far....
     
    OreoKnight, Feb 15, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Use include()
    
    
    <?php
    
    include 'path/to/nav.php';
    
    ?>
    
    PHP:
    I think that's what you want?
     
    nico_swd, Feb 15, 2008 IP
  3. OreoKnight

    OreoKnight Peon

    Messages:
    95
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Isn't this the second time you have helped me today. :)
     
    OreoKnight, Feb 15, 2008 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    Possibly. :p I'm losing track of who I've helped.
     
    nico_swd, Feb 15, 2008 IP
  5. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #5
    I like to use two menus. One for the home page and one for all the other pages because I hate having a link to the home page on the home page.

    Other than that I do it exactly like nico said.

    Wanna see it work?

    edit: The actual menus that apear at the bottom of each article page are completely generated by the system. This is a non-database site.
     
    Colbyt, Feb 15, 2008 IP