Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    May 2007
    Location
    Norfolk, UK
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Multiple Tier System

    Hi Guys,

    First post here on CodingForums, so I'll say hi!!

    I wonder if someone could give me a little help on a problem I have. I've been asked if I can design a directory website. I have created directory sites before with only 3 levels. E.G. Directory > Plumbers > (Business Name).

    However for the site I'm building now I need to be able to add as many levels as I need, in any category. Usually what I do is create a table for each 'level' needed, then link them together.

    What would be the best way to achieve what I'm after here? I was wondering about creating an ASP page that creates a table but then I don't know how to control the table from the admin control panel. This is because I cant choose which table the recordset displays.

    I'm really puzzled on this one and I would be very grateful if someone could give me some help.

    Many thanks in advance,

  • #2
    New to the CF scene
    Join Date
    May 2007
    Location
    Norfolk, UK
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    By the way I'm using ASP VB and MySQL if anyone is wondering.

    Please don't hesitate to ask for more information if you need it.

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    I think you would need to have a table of "levels" and each level has a parent level (null for no parent?), which would need to be searched recursively I suppose (I don't know if mysql has any way of doing this recursive lookup directly in the sql easily, I know sql server can and microsoft access can't but those are all I have tried) You may not actually need the recursion if you only need to see what is 1 level underneath the level you are currently looking at.

    Then you can have your standard table that lists the contents of each thing by the level it is in and all the information you need.

    For example you could have
    Levels (Name, Parent):
    Directory, NULL
    Builders, Directory
    Plumbers, Builders
    Carpenters, Builders

    Contents (Name, Level, Telephone Number)
    Some Plumber, Plumbers, 01234 567 890
    Some Builder, Builders, 00000 111 222

  • #4
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It depends on how you structure your database

    Here is an example of a recursive menu system
    http://forums.aspfree.com/code-bank-...ight=recursive

  • #5
    New to the CF scene
    Join Date
    May 2007
    Location
    Norfolk, UK
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    Hi,

    Thanks for your replies, I have built a database with two tables. They currently look like:

    Catgeories
    ID | ParentID | Type | Name | Description


    Listings
    ID | CatID | Name | Other Listing Info....


    Ok so I have my two tables, one Levels has been populated with some info. Problem is I cannot seem to be able to Get the directory working properly. I have a main category page which lists the main cats, then when clicked on takes you to the sub page which at the same time passes the ID of the cat so that the subcats can be displayed.

    When I click the sub category I have made it so it passes the SubcatID to yet another page which displays the subcats of the subcat. Now from this page I should be able to then click all the subcategories I need, and go however deep I need to.

    Problem is, all the parent ID's are the same, which only display on one page.

    I'm really confused about all this, can someone please help me? My brain is fried

    I've included a screenshot of the categories table.

    Thanks,
    Attached Thumbnails Attached Thumbnails Multiple Tier System-categoriestable.gif  


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •