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 >
Text File  |  2000-05-26  |  12KB  |  464 lines

  1. ##########################################################
  2. # C.D. record review site demo script (c) 1998 Global Data
  3. # Industries
  4. # Datasource=rreview.mdb (Access database)
  5. #
  6. # This script is *complex* (if you can understand all of
  7. # it, you are doing pretty well) but contains all sorts
  8. # of techniques that you may be able to make use of in
  9. # your own scripts! Data is extracted from a 3-tier
  10. # relational database. A top-level table contains the
  11. # list of different music styles held on the site, a second
  12. # table contains record name, review text etc. The final
  13. # table contains track listings for all the records. 
  14. # The relationships are:
  15. #        Records are held under a music style.
  16. #        Tracks are held under a record.
  17. #
  18. # The script generates all of the pages for the site,
  19. # even the ones that don't contain any database data.
  20. # (this was done just to keep the whole site together!)
  21. ##########################################################
  22.  
  23.  
  24.  
  25.  
  26. &cls
  27. &print("CD Record Reviews!!!")
  28. &print("-------------------------------")
  29.  
  30.  
  31.  
  32.  
  33. ##########################################################
  34. # The CD review database
  35.  
  36. &datasource("Driver={Microsoft Access Driver (*.mdb)};DBQ=rreview.mdb")
  37.  
  38.  
  39.  
  40.  
  41. ##########################################################
  42. # define variables used in script
  43.  
  44. &defvar(?test?,?len?,?pagecount?)
  45. &assign(?pagecount?,1)
  46.  
  47.  
  48.  
  49.  
  50. ##########################################################
  51. # The top-level page contains a list of links, the link text
  52. # is taken from the music style table. Each link goes to a
  53. # page which contains all records held under that style.
  54.  
  55. &html("index.html")
  56. {
  57.     <HTML>
  58.     <HEAD>
  59.     <META name="keywords" content="rave, house, techno, hardcore, jungle, acid jazz, hip hop, goa, trance, dj mix, cd, review"> 
  60.     <META Name="description" content="Rave DJ Mix CD Review Site">
  61.     <TITLE>Rave CD Reviews</TITLE>
  62.     </HEAD>
  63.     <BODY BACKGROUND="house.jpg" TEXT="\#AA00D5">
  64.     <IMG SRC="rreview1.gif">
  65.     <BR><BR><BR><BR><BR>
  66.     <H1>=Rave CD Reviews==></H1>
  67.     <UL>
  68.     <H3>
  69.  
  70.     # process each music category
  71.     &getdata ("SELECT * FROM Style")
  72.     {
  73.         # Subroutine &recordlistings creates the list of links to the
  74.         # different music styles
  75.         &recordlistings
  76.     }
  77.  
  78.     <LI><A HREF="submit.html">SUBMIT A REVIEW!!</A>
  79.     <FONT SIZE="-1">(They don't appear here by magic ya know!)</FONT>
  80.     &submit
  81.     </H3>
  82.     </UL>
  83.     <BR><BR><BR>
  84.     Searching for a <A HREF="trax.html"><B>track</B></A><FONT SIZE=7>\?</FONT>
  85.     &trax
  86.     Searching for a <A HREF="rcol.html"><B>recordstore</B></A><FONT SIZE=7>\?</FONT>
  87.     &recordstore
  88.     <BR>
  89.     This site exists as a Microsoft Access relational database on my P.C, which I convert to a web
  90.     site \& copy to the web server at the click of a button using
  91.     <A HREF="http://www.gdidb.com/"><B>GDIdb software</B></A> when I can be bothered. \#-)<BR>
  92.     The site currently contains details of 
  93.  
  94.  
  95.     # select the whole record table as a recordset- done just to calculate
  96.     # the total number of CD's in the database
  97.     &sql("SELECT * FROM RecordNames")
  98.     {
  99.         ?recordsetsize?
  100.     }
  101.     
  102.     # insert the update date. strip leading zero off date by
  103.     # evaluating ?gdidbdate.d? as a number
  104.     &assign(?len?,?gdidbdate.d?)
  105.     
  106.     CD's, and was last updated from the database on ?len? ?gdidbdate.mn? ?gdidbdate.y?.
  107.     </BODY>
  108.     </HTML>
  109. }
  110.  
  111. &cls
  112. &print("?pagecount? pages of HTML created.")
  113.  
  114. # End of script
  115.  
  116.  
  117.  
  118.  
  119. ##########################################################
  120. # this sub creates the list of links to each style category,
  121. # together with the page containing the record info
  122.  
  123. &defsub("recordlistings")
  124. {
  125.     &print("Generating category ?StyleName?")
  126.     
  127.     # get all records held under the current music style bieng processed.
  128.     &sql("SELECT * FROM RecordNames WHERE StlyeKey=?StyleKey? ORDER BY Rating DESC")
  129.     {
  130.         # create the link on the top-level page.
  131.         <LI><A HREF="record?rownumber[-1]?.html">?StyleName[-1]?</A>
  132.         <FONT SIZE=-1>(?recordsetsize? CD's)</FONT>
  133.  
  134.         # create the page containing the list of record reviews!
  135.         &inc(?pagecount?)
  136.         &html("record?rownumber[-1]?.html")
  137.         {
  138.             <HTML>
  139.             <HEAD>
  140.             <TITLE>?StyleName[-1]?</TITLE>
  141.             </HEAD>
  142.             <BODY BACKGROUND="house.jpg" TEXT="\#AA00D5">
  143.             <TABLE CELLPADDING="5" BGCOLOR=WHITE>
  144.             <TR><TD ALIGN=CENTER BGCOLOR="\#361F72">
  145.             <H1><TT><FONT COLOR=WHITE>===?StyleName[-1]?===</FONT></TT></FONT></H1>
  146.             </TD></TR>
  147.             </TABLE>
  148.             <IMG SRC="rreview2.gif" ALIGN=RIGHT>
  149.             <BR><BR>
  150.             <A HREF="index.html"><B><FONT SIZE="5"><===bACK</FONT></B></A>
  151.             <BR><BR><BR><BR><BR><BR>
  152.             <DL>
  153.             
  154.             # for each record in the recordset, we need to build a CD review!
  155.             &foreachrow
  156.             {
  157.                 &buildreview
  158.             }
  159.             </DL>
  160.             </BODY>
  161.             </HTML>
  162.         }
  163.     }
  164. }
  165.  
  166.  
  167.  
  168.  
  169. ##########################################################
  170. # this sub creates a single review on the review page. the
  171. # only reason the code was split out of the recordlistings
  172. # subroutine is that there was so much code in the 1
  173. # subroutine it was starting to look messy!
  174.  
  175. &defsub("buildreview")
  176. {
  177.     <DD><H2>
  178.     <IMG SRC="spkr.gif" ALIGN=BOTTOM>
  179.     <FONT COLOR=BLACK>
  180.     ?RecordName?</FONT></H2>
  181.     <BR>
  182.     <TABLE CELLPADDING="10" WIDTH="90%">
  183.     <TR VALIGN=TOP>
  184.     <TD>
  185.     <H4><TT>
  186.  
  187.     # a rating of -1 means no review
  188.     Rating:
  189.     &if(?Rating?!=-1)
  190.     {
  191.         ?Rating?/10<BR>
  192.         
  193.         # put "get it!" text in if it got more than 7/10 in it's review!
  194.         &if(?Rating?>7)
  195.         {
  196.             (Get it!)<BR>
  197.         }
  198.         <BR>
  199.     }
  200.     &else
  201.     {
  202.         No rating given.<BR>
  203.     }
  204.  
  205.     # if the reviewer box is blank, I reviewed it!
  206.     Reviewed by:
  207.     &if("?Reviewer?",eq,"")
  208.     {
  209.         Me!
  210.     }
  211.     &else
  212.     {
  213.         ?Reviewer?
  214.     }
  215.     <BR>
  216.     
  217.     # put the review date on the page- if there's no review date, 
  218.     # put "B4 1997"
  219.     On:
  220.     &if("?ReviewDate?",ne,"")
  221.     {
  222.         ?ReviewDate?
  223.     }
  224.     &else
  225.     {
  226.         B4 1997
  227.     }
  228.     
  229.     <BR>
  230.     </TT></H4>
  231.     (:-<A HREF="track?rownumber?x?rownumber[-1]?.html">TRAX</A>-:)
  232.     
  233.     # run the subroutine that creates the track listing page for this record
  234.     &tracklistings
  235.     </TD>
  236.     <TD>
  237.     ?Review?
  238.     </TD></TR>
  239.     </TABLE>
  240.     <BR><BR><BR>
  241. }
  242.  
  243.  
  244.  
  245.  
  246. ##########################################################
  247. # this sub creates the pages with the track listings for
  248. # the current record
  249.  
  250. &defsub("tracklistings")
  251. {
  252.     &inc(?pagecount?)
  253.     &html("track?rownumber?x?rownumber[-1]?.html")
  254.     {
  255.         <HTML>
  256.         <HEAD>
  257.         <TITLE>?RecordName?</TITLE>
  258.         </HEAD>
  259.         <BODY BACKGROUND="house.jpg" TEXT="\#AA00D5">
  260.         <H1><FONT COLOR=BLACK><TT>?RecordName?</TT></FONT></H1>
  261.         <A HREF="record?rownumber[-1]?.html"><B><===bACK</B></A>
  262.         <BR><BR>
  263.         <OL>
  264.         &getdata("SELECT * FROM Tracks WHERE RnameKey=?RecordKey? ORDER BY TrackKey")
  265.         {
  266.             # if the 1st 2 characters of the track name are "cd", then this
  267.             # is the start of a new cd listing of a multi cd set.
  268.             &assign(?test?,"?TrackName?")
  269.             &strtrim(?test?,"?test?")
  270.             &midstr(?test?,"?test?",0,2)
  271.             &if("?test?",ne.nc,"cd")
  272.             {
  273.                 <LI>?TrackName?
  274.             }
  275.             &else
  276.             {
  277.                 &strlen(?len?,"?TrackName?")
  278.                 # strip off 1st 2 letters "cd"
  279.                 &midstr(?test?,"?TrackName?",3,?len?-2)
  280.                 </OL>
  281.                 <B>?test?</B>
  282.                 <OL>
  283.             }
  284.         }
  285.         
  286.         # if the recordset is empty, no track listing was supplied
  287.         &else
  288.         {
  289.             Apologies! The lazy git that reviewed this
  290.             one didn't supply a track listing.. \#-)
  291.         }
  292.         </OL>
  293.         </BODY>
  294.         </HTML>
  295.     }
  296. }
  297.  
  298.  
  299.  
  300.  
  301. ##########################################################
  302. # this sub creates single-page record/track listings,
  303. # allowing the surfer to use their web browser "text search"
  304. # to find a track
  305.  
  306. &defsub("trax")
  307. {
  308.     &print("Creating single-page track list..")
  309.     &inc(?pagecount?)
  310.     &html("trax.html")
  311.     {
  312.         <HTML>
  313.         <HEAD>
  314.         <TITLE>Single Page Track \& Record Listings</TITLE>
  315.         </HEAD>
  316.         <BODY BACKGROUND="house.jpg" TEXT="\#AA00D5">
  317.         <TABLE CELLPADDING="10">
  318.         <TR><TD BGCOLOR="\#AA00D5">
  319.         <H1><FONT COLOR=WHITE><TT>Single Page Track \& Record Listings</TT></FONT></H1>
  320.         </TD></TR>
  321.         </TABLE>
  322.         <BR><BR>
  323.         <A HREF="index.html"><B><===bACK</B></A><BR><BR>
  324.  
  325.         O.K. So I know it's not very elegant, but use your browser's text search
  326.         to search the following list for a artist or track, \& you'll find the record it's on... \#-)
  327.  
  328.         &getdata("SELECT * FROM RecordNames")
  329.         {
  330.             <H3>?RecordName?</H3>
  331.             <UL>
  332.             &getdata("SELECT * FROM Tracks WHERE RnameKey=?RecordKey?")
  333.             {
  334.                 # don't print records that mark the start of 
  335.                 #  multi-c.d. set (i.e. they contain "cd")
  336.                 
  337.                 &assign(?test?,"?TrackName?")
  338.                 &strtrim(?test?,"?test?")
  339.                 &midstr(?test?,"?test?",0,2)
  340.                 &if("?test?",ne.nc,"cd")
  341.                 {
  342.                     <LI>?TrackName?
  343.                 }
  344.             }
  345.             </UL>
  346.         }
  347.         </BODY>
  348.         </HTML>
  349.     }
  350. }
  351.  
  352.  
  353.  
  354.  
  355. ##########################################################
  356. # the following 2 subroutines generate pages that are part
  357. # of the site, but don't actually contain any database data.
  358.  
  359. &defsub("submit")
  360. {
  361.     &html("submit.html")
  362.     {
  363.         <HTML>
  364.         <HEAD>
  365.         <TITLE>Submit a review</TITLE>
  366.         </HEAD>
  367.         <BODY BACKGROUND="house.jpg" TEXT="\#AA00D5">
  368.         <TABLE CELLPADDING="10">
  369.         <TR><TD BGCOLOR="\#AA00D5">
  370.         <H1><FONT COLOR=WHITE><TT>Submit a review</TT></FONT></H1>
  371.         </TD><TR>
  372.         </TABLE>
  373.         <BR><BR>
  374.         <A HREF="index.html"><B><===bACK</B></A>
  375.         <H3>Many thanks for helping this site grow! Please
  376.         <A HREF="mailto:philip@filo.demon.co.uk">e-mail</A>
  377.         me the following information, and I'll add it to the database!</H3>
  378.         <B>
  379.         <UL>
  380.         <LI>Reviewer Name:
  381.         <LI>Record Details: (Name, Code, \& Release date or as many of them as you have!)
  382.         <LI>Record Category:
  383.         <LI>Marks out of ten:
  384.         <LI>Review:
  385.         <LI>Track Listing:
  386.         </UL>
  387.         </B>
  388.         <BR><BR>
  389.         <H3>Example:</H3>
  390.         <UL>
  391.         <LI><B>Reviewer Name:</B> Joe Bloggs
  392.         <LI><B>Record Details:</B> Journeys by DJ- Rocky \& Diesel.(JDJCD7)1995
  393.         <LI><B>Record Category:</B>Tribal/Deep house
  394.         <LI><B>Marks out of ten:</B> 8
  395.         <LI><B>Review:</B>
  396.         There's some really excellent deep house on this one, trancy
  397.         building \& funkkky!! Sadly there's also about 5 or so rather
  398.         lightweight \& trashy garagey numbers mixed in with them........
  399.         Still pretty damm good, 'tho \& worth getting!!! 
  400.         <LI><B>Track Listing:</B>
  401.         <UL>
  402.         Tunnel vision* Aphrohead.<BR>
  403.         Come back* DJ Depressed.<BR>
  404.         Future* Mr Monday.<BR>
  405.         Catch a groove* Marshall's party feat.<BR>
  406.         I got the music* Maurice Joshua.<BR>
  407.         Triptonite* 28 East Boyz.<BR>
  408.         House music machine* Darkside.<BR>
  409.         House is a feeling* Sunday school.<BR>
  410.         Feelings are here to stay* Sounds unseen.<BR>
  411.         If you should need a friend* Fire island.<BR>
  412.         Dark corners* Swag.<BR>
  413.         A watcher's point of view* PM Dawn.<BR>
  414.         Love Vs Hate* Leauge of sinners.<BR>
  415.         Let's get ready to rumble* DJ Giovanni.<BR>
  416.         Black Sky* Shakespears sisters.<BR>
  417.         Colour of my skin* Swing 52.<BR>
  418.         Manhatten anthem* East village loft society.<BR>
  419.         Thank you* Chugger.<BR>
  420.         Let's get horny* Hi Voltage.<BR>
  421.         Garden of earthly delights* D-Note.<BR>
  422.         </UL>
  423.         </UL>
  424.         </BODY>
  425.         </HTML>
  426.     }
  427. }
  428.  
  429.  
  430.  
  431.  
  432. &defsub("recordstore")
  433. {
  434.     &html("rcol.html")
  435.     {
  436.         <HTML>
  437.         <HEAD>
  438.         <TITLE> Record companies on the net.</TITLE></HEAD>
  439.         <BODY BACKGROUND="house.jpg" TEXT=\#AA00D5>
  440.         <TABLE CELLPADDING="10">
  441.         <TR><TD BGCOLOR="\#AA00D5">
  442.         <H1><FONT COLOR=WHITE><TT>Record Companies On The Net</TT></FONT></H1>
  443.         </TD><TR>
  444.         </TABLE>
  445.         <BR><BR>
  446.         <A HREF="index.html"><B><===bACK</B></A>
  447.         <BR><BR>
  448.         <H3>
  449.         <UL>
  450.         <LI><A HREF="http://www.techno.de/outland/" TARGET="_blank">OUTLAND</A> records.
  451.         <LI>STC International Mail Order Company.
  452.         e-mail <A HREF="mailto:sales@stchq.demon.co.uk">sales@stchq.demon.co.uk</A>
  453.         or chekkout thier <A HREF="http://www.maths.ex.ac.uk/~james/tekno/stc.html" TARGET="_blank">
  454.         newsletter</A> on the WWW.
  455.         <LI><A HREF="http://www.tagrecords.co.uk/" TARGET="_blank">TAG</A>
  456.         Records. \{they do mail order!\}
  457.         <LI><A HREF="http://www.funkyworld.co.uk/" TARGET="_blank">Funkyworld</A>
  458.         Record store.
  459.         <LI><A HREF="http://www.io.org/~evrfrsh/flex/flex.html" TARGET="_blank">FLEX</A> Records.
  460.         </UL></H3>
  461.         <FONT SIZE=7 COLOR=BLACK>
  462.         </BODY></HTML>
  463.     }
  464. }