Menu from database ?

Discussion in 'ASP General' started by Klaus Andersen, Mar 13, 2005.

  1. 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
    Klaus Andersen, Mar 13, 2005
    #1
    1. Advertising

  2. Klaus Andersen

    Tim Guest

    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
    Tim, Mar 13, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Miguel Dias Moura
    Replies:
    3
    Views:
    4,276
    Bruno Sirianni
    Apr 3, 2004
  2. Vilmar
    Replies:
    0
    Views:
    452
    Vilmar
    May 27, 2004
  3. itzikkl
    Replies:
    0
    Views:
    5,748
    itzikkl
    Mar 27, 2005
  4. mike
    Replies:
    2
    Views:
    589
  5. Bryan
    Replies:
    1
    Views:
    763
    Steven Cheng[MSFT]
    Mar 1, 2006
Loading...

Share This Page