home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 October / Chip_2001-10_cd1.bin / sharewar / gdidbpro / data1.cab / Example_Files / projects / default / foodstore.scp < prev    next >
Text File  |  2000-05-26  |  4KB  |  138 lines

  1. ##########################################################
  2. # GDIdb demo script (c) 1998 Global Data Industries
  3. #
  4. # In this basic example, the contents of the spreadsheet
  5. # is merged with the site html using html table tags,
  6. # producing a table similar to the spreadsheet itself.
  7. ##########################################################
  8.  
  9.  
  10.  
  11.  
  12. ##########################################################
  13. # declare variable used by script
  14. &defvar(?name?)
  15.  
  16.  
  17.  
  18. ##########################################################
  19. # Print the information screen
  20.  
  21. &cls
  22. &print("Foodstore Demo Script")
  23. &print("---------------------------------")
  24.  
  25.  
  26.  
  27.  
  28. ##########################################################
  29. # get the name of the person running the script
  30.  
  31. &input(?name?,"Please enter your name")
  32.  
  33.  
  34.  
  35.  
  36. ##########################################################
  37. # Declare the ODBC datasource
  38.  
  39. &datasource("Driver={Microsoft Excel Driver (*.xls)};DBQ=foodstore.xls")
  40.  
  41.  
  42.  
  43.  
  44. ##########################################################
  45. # generate html
  46.  
  47. &print("Generating HTML...")
  48. &html("index.html")
  49. {
  50.     <HTML>
  51.     <HEAD>
  52.     <TITLE>The Essential Programmer's Online Foodstore</TITLE>
  53.     </HEAD>
  54.     <BODY BACKGROUND="burger.gif">
  55.     <IMG SRC="fries.gif" ALIGN=LEFT>
  56.     <IMG SRC="fries.gif" ALIGN=RIGHT>
  57.     <CENTER>
  58.     <BR><BR>
  59.     <FONT COLOR="\#B48424">
  60.     <H1>The Essential Programmer's<BR> 
  61.     Online Foodstore</H1>
  62.     </FONT>
  63.     <BR CLEAR=LEFT> 
  64.     <TABLE BORDER=0 WIDTH="80%">
  65.     <TR><TD><FONT FACE="Arial,Helvetica">
  66.     <P>Here at <B>The Essential Programmer's Online Foodstore,</B>
  67.     we <I>know</I> a serious coding session requires <I>full and professional</I>
  68.     support. That's why we've given you that support. Where you want it. Online.
  69.     When you want it. 24 Hours a day. Every day. (Unless we're at the beach)
  70.     <P>The Essential Programmer's Online Foodstore. More than just a luxury, we
  71.     <I>DARE</I> you to try programming without our URL in your bookmarks!
  72.     <BR><BR><BR>
  73.     <FONT COLOR=RED SIZE="+1">Site updated 
  74.  
  75.     # only include user's name if they actually bothered to enter it!
  76.     &if("",ne,"?name?")
  77.     {
  78.         by ?name?
  79.     }
  80.  
  81.     at ?gdidbtime? on ?gdidbdate.dn? ?gdidbdate?.</FONT>
  82.  
  83.     </FONT>
  84.     </TD></TR>
  85.     </TABLE>
  86.     </CENTER>
  87.     <BR><BR><BR>
  88.     <CENTER>
  89.     <IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif">
  90.     </CENTER>
  91.     <FONT SIZE="+3">Price list:</FONT><BR>
  92.     <TABLE WIDTH="100%">
  93.     <TR>
  94.     <TD><FONT SIZE="+2">Item</FONT></TD>
  95.     <TD><FONT SIZE="+2">Stock</FONT></TD>
  96.     <TD><FONT SIZE="+2">Cost</FONT></TD>
  97.     <TD><FONT SIZE="+2">Per</FONT></TD> 
  98.     <TD><FONT SIZE="+2">VAT</FONT></TD>
  99.     <TD><FONT SIZE="+2">Delivery</FONT></TD>
  100.     <TD><FONT SIZE="+2">Total</FONT></TD>
  101.     </TR>
  102.  
  103.     # loop through each row of the recordset, turning the spreadsheet
  104.     # table into a HTML table
  105.  
  106.     &getdata("SELECT * FROM sheet")
  107.     {
  108.         <TR>
  109.         <TD>?Item?</TD>
  110.         <TD>?Stock?</TD> 
  111.         <TD>ú?Cost?</TD>
  112.         <TD>?Per?</TD>
  113.         <TD>ú?VAT?</TD>
  114.         <TD>ú?Delivery?</TD>
  115.         <TD>ú?Total?</TD>
  116.         </TR>
  117.     }
  118.     </TABLE>
  119.     <CENTER>
  120.     <IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif"><IMG SRC="donut.gif">
  121.     </CENTER>
  122.     </BODY>
  123.     </HTML>
  124. }
  125.  
  126.  
  127.  
  128.  
  129. ##########################################################
  130. # print closing information
  131.  
  132. &cls
  133. &print("Demo web site HTML generation complete! Click the Preview HTML button to see the results.")
  134. &print
  135. &print
  136.  
  137. # END OF SCRIPT
  138.