Home All Groups Group Topic Archive Search About


Author
13 Mar 2005 5:18 PM
Klaus Andersen
Hi group

I realy need help for this. I must say that i am pretty unskilled as
programmer, so please dont be to tough with me :-)

I am trying to make a menu for my cms.

I got a db that looks like this:

------------------------------------------------
uid          id           level     menuitem
------------------------------------------------
0            873        0          Top level 1
873        874        1          sub 1 subpage
0            875        0          Top level 2
875        876        1          sub 2 subpage 1
875        877        1          sub 2 subpage 2
873        878        1          sub 1 subpage 2
0            879        0          Top level 3
879        880        1          sub 3 subpage 1
879        885        1          sub 3 subpage 2
879        886        1          sub 3 subpage 3
886        887        2          sub 4 subpage 1
886        888        2          sub 4 subpage 2
------------------------------------------------

What i want is a top menu and for each top menu item i want a left menu -
and for the left menu items i want subitems and so on.When users click menu
items they must be highlighted - also sub and subsub.
It is most important that users can save the url in "favorites" and that all
the menu steps are highlighted as they where when the user first chose the
page - when they enter the page from "favorites" og type in the url again
later.

That means that a page like "artikel.asp?id=888" should leave a highlighted
top menu (879) a left side sublevel (886) and a subsub level (888).

Can some of you please help me with a code snipet?

Best regards to group

KA

Author
13 Mar 2005 8:38 PM
Tim
Klaus Andersen wrote:
> Can some of you please help me with a code snipet?
I hope you will get agood answer to this but I doubt it, the question is
to broad and contains to little details.

Your best bet is probably to write as much code as you can and ask for
directions when you get stuck. At that point, also include the code you
have written so far.

I planed to give you some advice to get you started here but then I
realized I am not even sure what you want to accomplish.
It is easy enough to find all the toplevels:

SELECT * FROM table WHERE level=0

But how then do you know what sublevel belongs to what top level? My
guess is that you want two cathegory columns instead of the level column
and item column.

uid  id cat1 cat2
         top1 item1
         top1 item2
         top2 item3

This table would mean that item1 and item 2 are two elements in the
first cathegory, item3 on the other hand is the only item in the top2
category.

I am not at al sure if this is what you meant or if I am way of but my
best advice is to write some code and try to get it to work and post
your best efforts here.

Tim

AddThis Social Bookmark Button