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

    Join Date
    Feb 2011
    Posts
    6
    Rep Power
    0

    Need persistent CSS menu...


    I have over 700 pages on my website. It has a left-side menu, which appears on all pages, and every time I change anything on the menu I have to manually update all 700 pages. Obviously, this is not efficient(!), but I haven't been able to figure out how to put code on each page that will pull up the menu, aligned correctly with respect to the rest of the page, so that I can just change one file for the menu each time. Surely there is a way to do this? I'm pretty tied to my site's current look and don't want to change it at this time, so solutions that would require a change in appearance won't work for me.

    All input/advice is much appreciated!

    Site: webnesia.com
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4309
    Welcome to DevShed Forums, Areteo.

    That is not something that CSS can do by itself.

    You need a server-side language, like PHP, to keep an HTML document in multiple files like that. Check out this tutorial on how to use PHP includes.
    Spreading knowledge, one newbie at a time.

    Learn CSS. | PHP includes | HTML Validator | CSS validator

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2011
    Posts
    6
    Rep Power
    0
    Thanks for the reply, Kravvitz. I had looked at includes before, but my menu is a little more complex than just a simple list and I'm not sure I can keep the same look, which I really want to do, with the php solution. Is that possible, do you think? I don't want to have to dumb down my menu.
  6. #4
  7. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4309
    PHP includes allow you to put the entire left column (or everything in it) into a separate file. They work fine with practically all menus.

    The left menu on webnesia.com could use an overhaul. For one thing, is there a particular reason for JavaScript being used to generate some of the links? Do you really want to hide them from search engines (and probably some other visitors too)?
    Spreading knowledge, one newbie at a time.

    Learn CSS. | PHP includes | HTML Validator | CSS validator

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2011
    Posts
    6
    Rep Power
    0
    Originally Posted by Kravvitz
    The left menu on webnesia.com could use an overhaul. For one thing, is there a particular reason for JavaScript being used to generate some of the links? Do you really want to hide them from search engines (and probably some other visitors too)?
    All of my menu items are hand coded. I guess you are referring to the archive links at the bottom of the left column? Those are automatically generated by Blogger.

    I guess I will play around with the php/include code and see if I can get it to work with my layout. Thanks for the encouragement!
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2011
    Posts
    6
    Rep Power
    0
    Okay, here's a related question, my front page is a blog hosted on blogger. Can I save THAT page as php in order to use the included menu?

    Originally Posted by Kravvitz
    PHP includes allow you to put the entire left column (or everything in it) into a separate file. They work fine with practically all menus.

    The left menu on webnesia.com could use an overhaul. For one thing, is there a particular reason for JavaScript being used to generate some of the links? Do you really want to hide them from search engines (and probably some other visitors too)?
  12. #7
  13. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4309
    There's a very small chance of that. Does that page only live on a Blogger server or do you use another web host too?

    I guess you are referring to the archive links at the bottom of the left column? Those are automatically generated by Blogger.
    Oh... Yet another reason to dislike Blogger.
    Spreading knowledge, one newbie at a time.

    Learn CSS. | PHP includes | HTML Validator | CSS validator

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2011
    Posts
    6
    Rep Power
    0
    I used to host it on my own server, where the rest of my site is, but last year Blogger stopped supporting that and I had to move it to their hosting. I'm looking into changing to a WordPress blog hosted on my site, but I'm not sure I'll be able to pull that off.

    Originally Posted by Kravvitz
    There's a very small chance of that. Does that page only live on a Blogger server or do you use another web host too?


    Oh... Yet another reason to dislike Blogger.
  16. #9
  17. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4309
    It's very unlikely Blogger supports PHP, so you'll have to maintain that separately for now.

    I'm looking into changing to a WordPress blog hosted on my site, but I'm not sure I'll be able to pull that off.
    Yeah, installing a large PHP script for the first time can be quite intimidating. As I recall, installing it is fairly straight-forward. Customizing it, on the other hand, can take quite a bit of work. There are many pre-made themes and plugins you can use though. It has great community support.
    Spreading knowledge, one newbie at a time.

    Learn CSS. | PHP includes | HTML Validator | CSS validator

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  18. #10
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2011
    Posts
    6
    Rep Power
    0
    So I guess I'm back to my original thought, that there is no way for me to avoid having to manually update 700+ pages every time I change my menu and still keep my menu (which I'm not ready to give up). Sigh.

    Originally Posted by Kravvitz
    It's very unlikely Blogger supports PHP, so you'll have to maintain that separately for now.


    Yeah, installing a large PHP script for the first time can be quite intimidating. As I recall, installing it is fairly straight-forward. Customizing it, on the other hand, can take quite a bit of work. There are many pre-made themes and plugins you can use though. It has great community support.

IMN logo majestic logo threadwatch logo seochat tools logo