J
John Smith
Hi,
I'm trying to create an expandable menu system that updates depending on the
page that you are on, if a page has sub sections and you are on that page or
one of the sub sections then the menu will remain expanded.
The database layout is along the lines of : ID | pagetitle | subpage
This results in, for example, 'MyExamplePage' having the values : 12 |
MyExamplePage | 0
But the subpages that are linked to this page having the values : 17 | Menu
Option 1 | 12
The subpage value 12 being attached to the ID of the page that it is a
sub-page of.
Is this the correct way that the database should be layed out in an instance
like this ?
How would I work backwards through it to keep the menu expanded if I am on
the page Menu Option 1 ?
Thanks
J.
'objRS1 is a fixed record for the rest of the page data
'Start Loop
Do
'Write the page title
Response.Write(objRS("pagetitle")) & "<br>"
'Check to see if the record we've just written is the page we're on.
If int(objRS1("ID"))=int(objRS("ID")) Then
' Grab all of the records from the DB with the same subpage value
strQuery2 ="SELECT pagetitle FROM content WHERE subpage='" &
int(objRS1("ID")) & "'"
set objRS2 = objConn.Execute(strQuery2)
'Check to see if there are any & then start writing them
If Not objRS2.EOF then
Do Until objRS2.EOF
Response.Write(objRS2("pagetitle")) & "<br>"
objRS2.MoveNext
Loop
End If
End If
'Start Again
objRS.MoveNext
Loop Until objRS.EOF
I'm trying to create an expandable menu system that updates depending on the
page that you are on, if a page has sub sections and you are on that page or
one of the sub sections then the menu will remain expanded.
The database layout is along the lines of : ID | pagetitle | subpage
This results in, for example, 'MyExamplePage' having the values : 12 |
MyExamplePage | 0
But the subpages that are linked to this page having the values : 17 | Menu
Option 1 | 12
The subpage value 12 being attached to the ID of the page that it is a
sub-page of.
Is this the correct way that the database should be layed out in an instance
like this ?
How would I work backwards through it to keep the menu expanded if I am on
the page Menu Option 1 ?
Thanks
J.
'objRS1 is a fixed record for the rest of the page data
'Start Loop
Do
'Write the page title
Response.Write(objRS("pagetitle")) & "<br>"
'Check to see if the record we've just written is the page we're on.
If int(objRS1("ID"))=int(objRS("ID")) Then
' Grab all of the records from the DB with the same subpage value
strQuery2 ="SELECT pagetitle FROM content WHERE subpage='" &
int(objRS1("ID")) & "'"
set objRS2 = objConn.Execute(strQuery2)
'Check to see if there are any & then start writing them
If Not objRS2.EOF then
Do Until objRS2.EOF
Response.Write(objRS2("pagetitle")) & "<br>"
objRS2.MoveNext
Loop
End If
End If
'Start Again
objRS.MoveNext
Loop Until objRS.EOF