Hello,
I am planning a website and would like to bounce some ideas to perhaps get some new ones or get myself pointed in the right direction.
The goal and background are as follows:
- asp, access, vbscript
- table called "StructureElements" with the fields: ElementId (e.g. 020100), ElementName (e.g. Products), ElementHref (e.g. products.asp), ElementLinks (e.g. 030100#030102#040500# ...)
The ElementId has a 3x2 form code, because the elements are actually a part of a three-level navigation bar. The first two digits explain the position on level 1, the second two position on level 2 and the last two the position on level 3. For example if we would have on the first level, second place element called Products this would have ElementId 020000, then on the second level Cars (020100) and on the third Ford (020101).
On each sub-page I would have (among other) two sections:
- submenu,
- links.
For the first one I would make something like (if we were for example on the second level):
SELECT ElementName, ElementHref FROM StructureElements WHERE ElementId LIKE '02__00' AND ElementId NOT LIKE '%0000'
And then Response.Write the list with a Do... Loop.
For the links part I would do:
- get the links field,
- break it up
- put the links in an array
- make a do... loop with the SQL and get each of the links
This would also require me to either declare the ElementId of the page I am on or get it out of the db according to the title.
Am I complicating too much? Is there a simpler way to the solution?
It was suggested to me that this could be a case of bad db design, so I ask what are the dis/advantages of having the ElementId, for example, in three columns instead of one.
Also, would it be better to have the links in a separate table (e.g. Links) with a layout similar to the following exapmple:
ElementId / LinkId
1 / 5
1 / 11
1 / 24
2 / 33
2 / 6
2 / 7
... / ...
If so, I would really like to know why, so I can learn for future use.
Thanks for your views and help.
I am planning a website and would like to bounce some ideas to perhaps get some new ones or get myself pointed in the right direction.
The goal and background are as follows:
- asp, access, vbscript
- table called "StructureElements" with the fields: ElementId (e.g. 020100), ElementName (e.g. Products), ElementHref (e.g. products.asp), ElementLinks (e.g. 030100#030102#040500# ...)
The ElementId has a 3x2 form code, because the elements are actually a part of a three-level navigation bar. The first two digits explain the position on level 1, the second two position on level 2 and the last two the position on level 3. For example if we would have on the first level, second place element called Products this would have ElementId 020000, then on the second level Cars (020100) and on the third Ford (020101).
On each sub-page I would have (among other) two sections:
- submenu,
- links.
For the first one I would make something like (if we were for example on the second level):
SELECT ElementName, ElementHref FROM StructureElements WHERE ElementId LIKE '02__00' AND ElementId NOT LIKE '%0000'
And then Response.Write the list with a Do... Loop.
For the links part I would do:
- get the links field,
- break it up
- put the links in an array
- make a do... loop with the SQL and get each of the links
This would also require me to either declare the ElementId of the page I am on or get it out of the db according to the title.
Am I complicating too much? Is there a simpler way to the solution?
It was suggested to me that this could be a case of bad db design, so I ask what are the dis/advantages of having the ElementId, for example, in three columns instead of one.
Also, would it be better to have the links in a separate table (e.g. Links) with a layout similar to the following exapmple:
ElementId / LinkId
1 / 5
1 / 11
1 / 24
2 / 33
2 / 6
2 / 7
... / ...
If so, I would really like to know why, so I can learn for future use.
Thanks for your views and help.