simple php include

Discussion in 'PHP' started by tony84, Nov 28, 2005.

  1. #1
    ok i have http://giusepperossi.net its working and its ok but i want to make it so my menu is read from a php include file ive done this a number of times although my menu has never used css so im not sure if thats the problem anyway
    i basically want my menu in a file called menu.inc, anyone know how i can do this? as what i normally use doesnt work

    Tony
     
    tony84, Nov 28, 2005 IP
  2. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #2
    Basically just put in the code

    include 'menu.inc.php';

    If you have already called the css file in the main page then you dont have to worry about the css.
     
    Weirfire, Nov 28, 2005 IP
  3. tony84

    tony84 Well-Known Member

    Messages:
    1,864
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    140
    #3
    ok on the left is how it should look on the right is how it looks when i put the include php part
     
    tony84, Nov 28, 2005 IP
  4. dave487

    dave487 Peon

    Messages:
    701
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What does the file you are including look like? Have you tried opening this in a browser window on its own?
     
    dave487, Nov 28, 2005 IP
  5. tony84

    tony84 Well-Known Member

    Messages:
    1,864
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    140
    #5
    <div class="buttonscontainer">
    <div class="buttons">
    <a href="http://www.giusepperossi.net/index.php">Home</a>
    <a href="http://www.giusepperossi.net/Stats.php">Stats</a>
    <a href="http://www.giusepperossi.net/history.php">History</a>
    <a href="http://www.giusepperossi.net/profile.php">Profile</a>
    </div>
    </div>

    thats whats included in the .inc file, it should be fine as its exactly the same as whats on the left hand side
     
    tony84, Nov 28, 2005 IP
  6. dave487

    dave487 Peon

    Messages:
    701
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #6
    does this open ok in the browser?

    Is the file you include created in the same editor? I think the file may be corrupted - try creating a new file and cut+pasting the menu from your main page source code.
     
    dave487, Nov 28, 2005 IP
  7. tony84

    tony84 Well-Known Member

    Messages:
    1,864
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    140
    #7
    i cba anymorei ant really see me adding that many pages its only a little fan site so ill just add the menu as it is.
     
    tony84, Nov 28, 2005 IP
  8. tony84

    tony84 Well-Known Member

    Messages:
    1,864
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    140
    #8
    sorted it :)
     
    tony84, Nov 28, 2005 IP