Nav Bar - how do I make it universal across website

Discussion in 'CSS' started by gladstone, Apr 27, 2007.

  1. #1
    Hi,

    I have a css drop down menu designed but I don't want to copy and paste its code into every page on the website because if I make a change to the menu I will have to go back and re-write those changes by hand. I want to do it so like stylesheets...


    I know a bit about stylesheets but I have no clue as to putting the code for a menu in one.

    Help please!

    thanks.
    magda
     
    gladstone, Apr 27, 2007 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    Google "server side includes". There is a standard syntax for servers, and most, if not all, server side scripting languages include some include method. Search your favorite language's manual.

    cheers,

    gary
     
    kk5st, Apr 27, 2007 IP
  3. gladstone

    gladstone Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I feel like a tool. But you mean a css manual?
     
    gladstone, Apr 27, 2007 IP
  4. bobby9101

    bobby9101 Peon

    Messages:
    3,292
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    0
    #4
    No, you need a Server Side Language (ASP or PHP)
     
    bobby9101, Apr 27, 2007 IP
  5. luthan

    luthan Peon

    Messages:
    162
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    use header and footer and put code in them that repeats throughout pages
    for example in php <?php include 'header.php'; ?> puts in header.php contents on your page
    so you can have a simple structure

    <?php include 'header.php'; ?>
    body of the page currently on
    <?php include 'footer.php'; ?>
     
    luthan, Apr 27, 2007 IP
  6. js09

    js09 Peon

    Messages:
    232
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    yeah includes are what you want
     
    js09, Apr 27, 2007 IP
  7. luckybee

    luckybee Peon

    Messages:
    151
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #7
    If your server doesn't support PHP or ASP, some websites editors (such as Dreamweaver) have a template feature that will update every page automatically.
     
    luckybee, Apr 30, 2007 IP
    gladstone likes this.
  8. Obelia

    Obelia Notable Member

    Messages:
    2,083
    Likes Received:
    171
    Best Answers:
    0
    Trophy Points:
    210
    #8
    SSI's are incredibly useful, but I imagine this isn't exactly what you're asking for. You need to put this at the head of every page:

    Replacing STYLESHEET with the filename of your stylesheet. Then all you will have to do is edit the stylesheet to alter the styles across your whole website.
     
    Obelia, May 1, 2007 IP
  9. gladstone

    gladstone Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Can I include the menu code in my style sheet though? When I tried it didn't seem to work.
     
    gladstone, May 1, 2007 IP
  10. semantic7

    semantic7 Member

    Messages:
    92
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    48
    #10
    You can import one style sheet in to another as below...

    @import url("fonts.css");
     
    semantic7, May 1, 2007 IP
  11. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #11
    No. The stylesheet is for presentation, not for content or markup. Includes are what you need. The include file is a simple snippet of the code that the server or the server side scripting language sticks into your page, kinda like a copy/paste thing.

    cheers,

    gary
     
    kk5st, May 1, 2007 IP
    gladstone likes this.
  12. gladstone

    gladstone Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12

    Thank you so much, I am looking into that now.
    And thank you to Gary. That is what I had assumed but wanted a more refined reassurance.

    magda
     
    gladstone, May 2, 2007 IP
  13. jgjg

    jgjg Peon

    Messages:
    595
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #13
    I recommend php includes...they are really the easiest to implement...but the webpages have to be php pages.
     
    jgjg, Jun 2, 2007 IP
  14. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Dan Schulz, Jun 2, 2007 IP
  15. duilen

    duilen Active Member

    Messages:
    354
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #15
    I would also go this route. They are easier and more reliable than dwts, bots or server side includes.
     
    duilen, Jun 2, 2007 IP