...

View Full Version : left vertical menu changes page content



htcilt
03-11-2010, 09:50 PM
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:
http://img.photobucket.com/albums/v368/flemmo/mockupmenu.png

htcilt
03-11-2010, 10:12 PM
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?

Excavator
03-11-2010, 11:12 PM
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

htcilt
03-12-2010, 06:17 PM
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/generating_dynamic_css_with_php/

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum