home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 October
/
Chip_2001-10_cd1.bin
/
sharewar
/
gdidbpro
/
data1.cab
/
Example_Files
/
projects
/
default
/
rreview.scp
< prev
next >
Wrap
Text File
|
2000-05-26
|
12KB
|
464 lines
##########################################################
# 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")
{
<HTML>
<HEAD>
<META name="keywords" content="rave, house, techno, hardcore, jungle, acid jazz, hip hop, goa, trance, dj mix, cd, review">
<META Name="description" content="Rave DJ Mix CD Review Site">
<TITLE>Rave CD Reviews</TITLE>
</HEAD>
<BODY BACKGROUND="house.jpg" TEXT="\#AA00D5">
<IMG SRC="rreview1.gif">
<BR><BR><BR><BR><BR>
<H1>=Rave CD Reviews==></H1>
<UL>
<H3>
# process each music category
&getdata ("SELECT * FROM Style")
{
# Subroutine &recordlistings creates the list of links to the
# different music styles
&recordlistings
}
<LI><A HREF="submit.html">SUBMIT A REVIEW!!</A>
<FONT SIZE="-1">(They don't appear here by magic ya know!)</FONT>
&submit
</H3>
</UL>
<BR><BR><BR>
Searching for a <A HREF="trax.html"><B>track</B></A><FONT SIZE=7>\?</FONT>
&trax
Searching for a <A HREF="rcol.html"><B>recordstore</B></A><FONT SIZE=7>\?</FONT>
&recordstore
<BR>
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
<A HREF="http://www.gdidb.com/"><B>GDIdb software</B></A> when I can be bothered. \#-)<BR>
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?.
</BODY>
</HTML>
}
&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.
<LI><A HREF="record?rownumber[-1]?.html">?StyleName[-1]?</A>
<FONT SIZE=-1>(?recordsetsize? CD's)</FONT>
# create the page containing the list of record reviews!
&inc(?pagecount?)
&html("record?rownumber[-1]?.html")
{
<HTML>
<HEAD>
<TITLE>?StyleName[-1]?</TITLE>
</HEAD>
<BODY BACKGROUND="house.jpg" TEXT="\#AA00D5">
<TABLE CELLPADDING="5" BGCOLOR=WHITE>
<TR><TD ALIGN=CENTER BGCOLOR="\#361F72">
<H1><TT><FONT COLOR=WHITE>===?StyleName[-1]?===</FONT></TT></FONT></H1>
</TD></TR>
</TABLE>
<IMG SRC="rreview2.gif" ALIGN=RIGHT>
<BR><BR>
<A HREF="index.html"><B><FONT SIZE="5"><===bACK</FONT></B></A>
<BR><BR><BR><BR><BR><BR>
<DL>
# for each record in the recordset, we need to build a CD review!
&foreachrow
{
&buildreview
}
</DL>
</BODY>
</HTML>
}
}
}
##########################################################
# 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")
{
<DD><H2>
<IMG SRC="spkr.gif" ALIGN=BOTTOM>
<FONT COLOR=BLACK>
?RecordName?</FONT></H2>
<BR>
<TABLE CELLPADDING="10" WIDTH="90%">
<TR VALIGN=TOP>
<TD>
<H4><TT>
# a rating of -1 means no review
Rating:
&if(?Rating?!=-1)
{
?Rating?/10<BR>
# put "get it!" text in if it got more than 7/10 in it's review!
&if(?Rating?>7)
{
(Get it!)<BR>
}
<BR>
}
&else
{
No rating given.<BR>
}
# if the reviewer box is blank, I reviewed it!
Reviewed by:
&if("?Reviewer?",eq,"")
{
Me!
}
&else
{
?Reviewer?
}
<BR>
# put the review date on the page- if there's no review date,
# put "B4 1997"
On:
&if("?ReviewDate?",ne,"")
{
?ReviewDate?
}
&else
{
B4 1997
}
<BR>
</TT></H4>
(:-<A HREF="track?rownumber?x?rownumber[-1]?.html">TRAX</A>-:)
# run the subroutine that creates the track listing page for this record
&tracklistings
</TD>
<TD>
?Review?
</TD></TR>
</TABLE>
<BR><BR><BR>
}
##########################################################
# this sub creates the pages with the track listings for
# the current record
&defsub("tracklistings")
{
&inc(?pagecount?)
&html("track?rownumber?x?rownumber[-1]?.html")
{
<HTML>
<HEAD>
<TITLE>?RecordName?</TITLE>
</HEAD>
<BODY BACKGROUND="house.jpg" TEXT="\#AA00D5">
<H1><FONT COLOR=BLACK><TT>?RecordName?</TT></FONT></H1>
<A HREF="record?rownumber[-1]?.html"><B><===bACK</B></A>
<BR><BR>
<OL>
&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")
{
<LI>?TrackName?
}
&else
{
&strlen(?len?,"?TrackName?")
# strip off 1st 2 letters "cd"
&midstr(?test?,"?TrackName?",3,?len?-2)
</OL>
<B>?test?</B>
<OL>
}
}
# 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.. \#-)
}
</OL>
</BODY>
</HTML>
}
}
##########################################################
# 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")
{
<HTML>
<HEAD>
<TITLE>Single Page Track \& Record Listings</TITLE>
</HEAD>
<BODY BACKGROUND="house.jpg" TEXT="\#AA00D5">
<TABLE CELLPADDING="10">
<TR><TD BGCOLOR="\#AA00D5">
<H1><FONT COLOR=WHITE><TT>Single Page Track \& Record Listings</TT></FONT></H1>
</TD></TR>
</TABLE>
<BR><BR>
<A HREF="index.html"><B><===bACK</B></A><BR><BR>
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")
{
<H3>?RecordName?</H3>
<UL>
&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")
{
<LI>?TrackName?
}
}
</UL>
}
</BODY>
</HTML>
}
}
##########################################################
# 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")
{
<HTML>
<HEAD>
<TITLE>Submit a review</TITLE>
</HEAD>
<BODY BACKGROUND="house.jpg" TEXT="\#AA00D5">
<TABLE CELLPADDING="10">
<TR><TD BGCOLOR="\#AA00D5">
<H1><FONT COLOR=WHITE><TT>Submit a review</TT></FONT></H1>
</TD><TR>
</TABLE>
<BR><BR>
<A HREF="index.html"><B><===bACK</B></A>
<H3>Many thanks for helping this site grow! Please
<A HREF="mailto:philip@filo.demon.co.uk">e-mail</A>
me the following information, and I'll add it to the database!</H3>
<B>
<UL>
<LI>Reviewer Name:
<LI>Record Details: (Name, Code, \& Release date or as many of them as you have!)
<LI>Record Category:
<LI>Marks out of ten:
<LI>Review:
<LI>Track Listing:
</UL>
</B>
<BR><BR>
<H3>Example:</H3>
<UL>
<LI><B>Reviewer Name:</B> Joe Bloggs
<LI><B>Record Details:</B> Journeys by DJ- Rocky \& Diesel.(JDJCD7)1995
<LI><B>Record Category:</B>Tribal/Deep house
<LI><B>Marks out of ten:</B> 8
<LI><B>Review:</B>
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!!!
<LI><B>Track Listing:</B>
<UL>
Tunnel vision* Aphrohead.<BR>
Come back* DJ Depressed.<BR>
Future* Mr Monday.<BR>
Catch a groove* Marshall's party feat.<BR>
I got the music* Maurice Joshua.<BR>
Triptonite* 28 East Boyz.<BR>
House music machine* Darkside.<BR>
House is a feeling* Sunday school.<BR>
Feelings are here to stay* Sounds unseen.<BR>
If you should need a friend* Fire island.<BR>
Dark corners* Swag.<BR>
A watcher's point of view* PM Dawn.<BR>
Love Vs Hate* Leauge of sinners.<BR>
Let's get ready to rumble* DJ Giovanni.<BR>
Black Sky* Shakespears sisters.<BR>
Colour of my skin* Swing 52.<BR>
Manhatten anthem* East village loft society.<BR>
Thank you* Chugger.<BR>
Let's get horny* Hi Voltage.<BR>
Garden of earthly delights* D-Note.<BR>
</UL>
</UL>
</BODY>
</HTML>
}
}
&defsub("recordstore")
{
&html("rcol.html")
{
<HTML>
<HEAD>
<TITLE> Record companies on the net.</TITLE></HEAD>
<BODY BACKGROUND="house.jpg" TEXT=\#AA00D5>
<TABLE CELLPADDING="10">
<TR><TD BGCOLOR="\#AA00D5">
<H1><FONT COLOR=WHITE><TT>Record Companies On The Net</TT></FONT></H1>
</TD><TR>
</TABLE>
<BR><BR>
<A HREF="index.html"><B><===bACK</B></A>
<BR><BR>
<H3>
<UL>
<LI><A HREF="http://www.techno.de/outland/" TARGET="_blank">OUTLAND</A> records.
<LI>STC International Mail Order Company.
e-mail <A HREF="mailto:sales@stchq.demon.co.uk">sales@stchq.demon.co.uk</A>
or chekkout thier <A HREF="http://www.maths.ex.ac.uk/~james/tekno/stc.html" TARGET="_blank">
newsletter</A> on the WWW.
<LI><A HREF="http://www.tagrecords.co.uk/" TARGET="_blank">TAG</A>
Records. \{they do mail order!\}
<LI><A HREF="http://www.funkyworld.co.uk/" TARGET="_blank">Funkyworld</A>
Record store.
<LI><A HREF="http://www.io.org/~evrfrsh/flex/flex.html" TARGET="_blank">FLEX</A> Records.
</UL></H3>
<FONT SIZE=7 COLOR=BLACK>
</BODY></HTML>
}
}