Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts

    left vertical menu changes page content

    Hi,

    I'm wanting to build a pages(s) with a vertical left menu in css.

    Clicking on each menu list item should update the content to the right (main body text) and introduce a marker to indicate which menu item you are on - this could just be a change in style e.g. bold font, or a small arrow image, bullet etc.

    Initially I was thinking of creating a page for each menu item, and a menu for each page. The problem here is e.g. 10 menu items would require 20 files with essentially the same content. This would also mean updating 20 times if any changes were needed.

    Could someone tell me when the best practice is to gain the functionality I'm after?

    Below is an image to illustrate the above:

  • #2
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts
    I'm using php so perhaps I could use dynamic css?

    e.g. the menu links would be:

    link.php?item1
    link.php?item2
    link.php?item3
    link.php?item4
    link.php?item5

    Then in the php echo the correct left menu style and main body content.

    Does this sound the way to go?

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,749
    Thanks
    22
    Thanked 1,838 Times in 1,822 Posts
    Hello htcilt,
    Sounds like you're after an include. You can make a menu.php that will be included on all your pages. Updates on that one file would be reflected on all the pages it's included on.
    Have a look at the basics explained here - http://www.tizag.com/phpT/include.php
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #4
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Hi,

    Thanks for the reply.
    Yes an include is just what I'm after for the menu.

    I'm also using an array to store each 'theme', then applying the required styles. This following link is really useful:
    http://www.digital-web.com/articles/..._css_with_php/

    It took a bit to get my head around it, but its coming along nicely now


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •