David Stoltz wrote:
Hi Folks,
I'm a PHP newbie - but this question really isn't about PHP per se',
it's more about programming in general, and how to do something...
I'm redesigning an ASP site with Dreamweaver CS4, so I'll be sticking to
using ASP technology....
The site will use horizontal navigation for the MAIN MENU which will be
static, but each page therein will have a vertical sub menu, probably
with 2-3 levels deep - which will need to be dynamic.
I'm trying to figure out a good way to organize and maintain the
submenus. I need each page to "know where it is" so the breadcrumb trail
can be accurate and dynamic. The page/menu will also need to know how to
display the correct submenu/level.....hopefully this all can be
dynamic....
I also want to avoid query string parameters, such as
page.asp?menu=1&submenu=3 type stuff.....
My current thought is to use URL rewriting and a database - but I'm not
sure if this is the best route....
Does anyone have any suggestions? HELP!
Thanks
At a very basic level I think a database is overkill. I would write
some sort of include for the top most menu, that includes a function to
generate the sub menus and a breadcrumb trail. This is psuedo-code, but
here's the idea:
// Include top menu and some functions.
include('menu-lib.php');
// Build sub-menu, using my location.
echo build_sub_menu('Contact', 'Sales " Marketing');
This way you can maintain all the menu/breadcrumb/etc in one file, and
have the information you need in each page to generate it.
HTH,
- Kyle