home *** CD-ROM | disk | FTP | other *** search
- ##########################################################
- # GDIdb demo script (c) 1998 Global Data Industries
- #
- # This script demonstrates how to group database records
- # alphabetically. A program loop is used to loop through
- # each letter in the alphabet, for each letter a recordset
- # is generated consisting of all the CD's whose names
- # start with that letter.
- #
- ##########################################################
-
-
-
- &datasource("Driver={Microsoft Access Driver (*.mdb)};DBQ=rreview.mdb")
-
-
-
- &defvar(?char?,?charl?,?count?)
-
-
-
-
- ##########################################################
- # the top-level document
-
- &html("index.html")
- {
- <HTML>
- <HEAD>
- <TITLE>Rave CD's</TITLE>
- </HEAD>
- <BODY BACKGROUND="house.jpg" TEXT="\#AA00D5">
- <IMG SRC="rreview1.gif">
- <BR><BR><BR><BR><BR>
- <CENTER><H4>
- Soul<BR>
- Acid Jazz<BR>
- Hip-Hop<BR>
- Tribal/Deep house<BR>
- Garage/Happy House<BR>
- </H4>
- <H1>\<==============Rave<BR>
- </H1>
- # loop through each letter in the alphabet
- <H2>
- &for(?count?,65,?count?<91,1)
- {
- # convert number to ASCII character
- &chr(?char?,?count?)
- &tolower(?charl?,"?char?")
- &print("Processing the letter ?char?")
- &rec
- }
- </H2>
- <H1>CD's==============\></H1><BR>
- <H4>
- Techno/Nu Energy<BR>
- Hardcore/Jungle<BR>
- Hard House<BR>
- Trance<BR>
- Goa<BR>
- </H4>
- </CENTER>
- <BR><BR><BR><BR><BR>\
- </BODY>
- </HTML>
- }
-
-
-
-
- ##########################################################
- # this sub retrieves the recordset which consists of record
- # names starting with the current letter. If the recordset
- # is not empty, a page is created listing all records
- # starting with this letter and the current letter is included
- # on the top-level page as a hyperlink. If the recordset
- # is empty, the letter is added to the page, but not as a link.
-
- &defsub("rec")
- {
- # The query looks for text beginning with upper OR lower case letter
- &sql("SELECT * FROM RecordNames WHERE ((RecordName LIKE '?char?%') OR (RecordName LIKE '?charl?%')) ORDER BY RecordName")
- {
- # only add a link (& a page to link to) if there are CD's under this letter
- &if(?recordsetsize?>0)
- {
- <A HREF="records?char?.html"><B>?char?</B></A>
- &catpage
- }
- &else
- {
- ?char?
- }
- }
- }
-
-
-
-
- ##########################################################
- # In the case that the recordset produced above is not
- # empty, this subroutine is called to produce the page
- # listing all records starting with the current letter.
-
- &defsub("catpage")
- {
- &html("records?char?.html")
- {
- <HTML>
- <HEAD>
- <TITLE>Records under the letter ?char?</TITLE>
- </HEAD>
- <BODY BACKGROUND="house.jpg" TEXT="\#AA00D5">
- <TABLE CELLPADDING="5" BGCOLOR=WHITE>
- <TR><TD ALIGN=CENTER BGCOLOR="\#361F72">
- <H1><TT><FONT COLOR=WHITE>==?char?==</FONT></TT></FONT></H1>
- </TD></TR>
- </TABLE>
- <IMG SRC="rreview2.gif" ALIGN=RIGHT>
- <BR><BR>
- <H3>We've the following records under the letter ?char?</H3><BR><BR>
- <UL>
- &foreachrow
- {
- <LI><B>?RecordName?<B>
- }
- </UL>
- </BODY>
- </HTML>
- }
- }
-