##########################################################
# C.D. record review site demo script (c) 1998 Global Data
# Industries
# Datasource=rreview.mdb (Access database)
#
# This script is *complex* (if you can understand all of
# it, you are doing pretty well) but contains all sorts
# of techniques that you may be able to make use of in
# your own scripts! Data is extracted from a 3-tier
# relational database. A top-level table contains the
# list of different music styles held on the site, a second
# table contains record name, review text etc. The final
# table contains track listings for all the records.
# The relationships are:
# Records are held under a music style.
# Tracks are held under a record.
#
# The script generates all of the pages for the site,
# even the ones that don't contain any database data.
# (this was done just to keep the whole site together!)
##########################################################
&cls
&print("CD Record Reviews!!!")
&print("-------------------------------")
##########################################################
# The CD review database
&datasource("Driver={Microsoft Access Driver (*.mdb)};DBQ=rreview.mdb")
##########################################################
# define variables used in script
&defvar(?test?,?len?,?pagecount?)
&assign(?pagecount?,1)
##########################################################
# The top-level page contains a list of links, the link text
# is taken from the music style table. Each link goes to a
# page which contains all records held under that style.
&html("index.html")
{
Rave CD Reviews
=Rave CD Reviews==>
# process each music category
&getdata ("SELECT * FROM Style")
{
# Subroutine &recordlistings creates the list of links to the
# different music styles
&recordlistings
}
- SUBMIT A REVIEW!!
(They don't appear here by magic ya know!)
&submit
Searching for a track\?
&trax
Searching for a recordstore\?
&recordstore
This site exists as a Microsoft Access relational database on my P.C, which I convert to a web
site \& copy to the web server at the click of a button using
GDIdb software when I can be bothered. \#-)
The site currently contains details of
# select the whole record table as a recordset- done just to calculate
# the total number of CD's in the database
&sql("SELECT * FROM RecordNames")
{
?recordsetsize?
}
# insert the update date. strip leading zero off date by
# evaluating ?gdidbdate.d? as a number
&assign(?len?,?gdidbdate.d?)
CD's, and was last updated from the database on ?len? ?gdidbdate.mn? ?gdidbdate.y?.
}
&cls
&print("?pagecount? pages of HTML created.")
# End of script
##########################################################
# this sub creates the list of links to each style category,
# together with the page containing the record info
&defsub("recordlistings")
{
&print("Generating category ?StyleName?")
# get all records held under the current music style bieng processed.
&sql("SELECT * FROM RecordNames WHERE StlyeKey=?StyleKey? ORDER BY Rating DESC")
{
# create the link on the top-level page.
?StyleName[-1]?
(?recordsetsize? CD's)
# create the page containing the list of record reviews!
&inc(?pagecount?)
&html("record?rownumber[-1]?.html")
{
?StyleName[-1]?
<===bACK
# for each record in the recordset, we need to build a CD review!
&foreachrow
{
&buildreview
}
}
}
}
##########################################################
# this sub creates a single review on the review page. the
# only reason the code was split out of the recordlistings
# subroutine is that there was so much code in the 1
# subroutine it was starting to look messy!
&defsub("buildreview")
{
?RecordName?
# a rating of -1 means no review
Rating:
&if(?Rating?!=-1)
{
?Rating?/10
# put "get it!" text in if it got more than 7/10 in it's review!
&if(?Rating?>7)
{
(Get it!)
}
}
&else
{
No rating given.
}
# if the reviewer box is blank, I reviewed it!
Reviewed by:
&if("?Reviewer?",eq,"")
{
Me!
}
&else
{
?Reviewer?
}
# put the review date on the page- if there's no review date,
# put "B4 1997"
On:
&if("?ReviewDate?",ne,"")
{
?ReviewDate?
}
&else
{
B4 1997
}
(:-TRAX-:)
# run the subroutine that creates the track listing page for this record
&tracklistings
|
?Review?
|
}
##########################################################
# this sub creates the pages with the track listings for
# the current record
&defsub("tracklistings")
{
&inc(?pagecount?)
&html("track?rownumber?x?rownumber[-1]?.html")
{
?RecordName?
?RecordName?
<===bACK
&getdata("SELECT * FROM Tracks WHERE RnameKey=?RecordKey? ORDER BY TrackKey")
{
# if the 1st 2 characters of the track name are "cd", then this
# is the start of a new cd listing of a multi cd set.
&assign(?test?,"?TrackName?")
&strtrim(?test?,"?test?")
&midstr(?test?,"?test?",0,2)
&if("?test?",ne.nc,"cd")
{
- ?TrackName?
}
&else
{
&strlen(?len?,"?TrackName?")
# strip off 1st 2 letters "cd"
&midstr(?test?,"?TrackName?",3,?len?-2)
?test?
}
}
# if the recordset is empty, no track listing was supplied
&else
{
Apologies! The lazy git that reviewed this
one didn't supply a track listing.. \#-)
}
}
}
##########################################################
# this sub creates single-page record/track listings,
# allowing the surfer to use their web browser "text search"
# to find a track
&defsub("trax")
{
&print("Creating single-page track list..")
&inc(?pagecount?)
&html("trax.html")
{
Single Page Track \& Record Listings
Single Page Track \& Record Listings
|
<===bACK
O.K. So I know it's not very elegant, but use your browser's text search
to search the following list for a artist or track, \& you'll find the record it's on... \#-)
&getdata("SELECT * FROM RecordNames")
{
?RecordName?
&getdata("SELECT * FROM Tracks WHERE RnameKey=?RecordKey?")
{
# don't print records that mark the start of
# multi-c.d. set (i.e. they contain "cd")
&assign(?test?,"?TrackName?")
&strtrim(?test?,"?test?")
&midstr(?test?,"?test?",0,2)
&if("?test?",ne.nc,"cd")
{
- ?TrackName?
}
}
}
}
}
##########################################################
# the following 2 subroutines generate pages that are part
# of the site, but don't actually contain any database data.
&defsub("submit")
{
&html("submit.html")
{
Submit a review
<===bACK
Many thanks for helping this site grow! Please
e-mail
me the following information, and I'll add it to the database!
- Reviewer Name:
- Record Details: (Name, Code, \& Release date or as many of them as you have!)
- Record Category:
- Marks out of ten:
- Review:
- Track Listing:
Example:
- Reviewer Name: Joe Bloggs
- Record Details: Journeys by DJ- Rocky \& Diesel.(JDJCD7)1995
- Record Category:Tribal/Deep house
- Marks out of ten: 8
- Review:
There's some really excellent deep house on this one, trancy
building \& funkkky!! Sadly there's also about 5 or so rather
lightweight \& trashy garagey numbers mixed in with them........
Still pretty damm good, 'tho \& worth getting!!!
- Track Listing:
Tunnel vision* Aphrohead.
Come back* DJ Depressed.
Future* Mr Monday.
Catch a groove* Marshall's party feat.
I got the music* Maurice Joshua.
Triptonite* 28 East Boyz.
House music machine* Darkside.
House is a feeling* Sunday school.
Feelings are here to stay* Sounds unseen.
If you should need a friend* Fire island.
Dark corners* Swag.
A watcher's point of view* PM Dawn.
Love Vs Hate* Leauge of sinners.
Let's get ready to rumble* DJ Giovanni.
Black Sky* Shakespears sisters.
Colour of my skin* Swing 52.
Manhatten anthem* East village loft society.
Thank you* Chugger.
Let's get horny* Hi Voltage.
Garden of earthly delights* D-Note.
}
}
&defsub("recordstore")
{
&html("rcol.html")
{
Record companies on the net.
Record Companies On The Net
|
<===bACK
}
}