PC Services"From Payroll to Body Scanners" |
Some PHP Tips and 'Tricks'Thinking beyond each page and DESIGNING your web site |
Example Menu SystemHaving discussed all the methods of menus, I describe the method of menu (and variants) I use on several informational sites. The menu on the left uses the techniques -
This is acheived using the Text buttons method with style sheets for colour schemes. Entries for menu control below - .menu, .selected, .sep { color: white; } .menu { background-color: #6666FF; } .menu:hover, .menu A:hover { color: black; background-color: #CC9900; } .menu A:link { color: white; text-decoration: none } .menu A:visited { color: yellow; text-decoration: none } .menu A:hover { color: black; text-decoration: underline; } .selected { background-color: #CC3300; } .sep { background-color: #999999; } The expanding menu is performed by two parts of include files -
The sub-menu include files are referenced to be a standard file type in a sub-folder, the calling menu array contains information on the folder to find the file and the included array of menu items. All paths to sub-menus or links are relative to current folder or external links. This way only a few arrays actually need to be included, improving execution time. The menu arrays could be tables in a database if you wanted, but that means it really should be on the same server to avoid failures. Using arrays in files uses less items of the server so is less prone to other causes of failure, if the file cannot be included wither there is a file fault, file missing, or such a fault that could not serve web pages anyway. To improve site maintenance it is assumed the files for the referenced pages on that menu, would reside in that folder as well, so things can be moved around between sections easily. This has helped me greatly on some sites that required splitting and moving products to different categories and in some cases splitting long sections, by moving whole folder trees and changing a few menu entries. For more information on the actual PHP scripts used here by contacting Paul Carpenter. |
| © 2010 onwards by PC Services, Reading UK | Last Updated: 9th January 2010 |
| If you encounter problems with this page please email your comments to webmaster | |