home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 October
/
Chip_2001-10_cd1.bin
/
sharewar
/
gdidbpro
/
data1.cab
/
Example_Files
/
projects
/
default
/
workweb3.scp
< prev
next >
Wrap
Text File
|
2000-05-26
|
6KB
|
254 lines
##########################################################
# GDIdb demo script (c) 1997 Global Data Industries
# Datasource=workweb.mdb (Access database)
#
# If you have a large table of data that you'd like to
# split across several HTML pages, study this script
# for hints on how to do it.
##########################################################
##########################################################
# Declare & initialise variables used in script
&defvar(?var1?,?categorysize?,?pagenum?,?ptot?,?lcount?,?tmp?)
&assign(?pagenum?,1)
##########################################################
# ?categorysize? sets the amount of jobs that are placed
# on each page. try changing the value from 3 to 4 to see
# the effect.
&assign(?categorysize?,3)
##########################################################
# Print the script information screen
&cls
&print("WorkWeb 3 Demo Script")
&print("------------------------------------")
##########################################################
# Declare the database file.
&datasource("Driver={Microsoft Access Driver (*.mdb)};DBQ=workweb.mdb")
##########################################################
# Start generating the HTML
&html("index.html")
{
<HTML>
<HEAD>
<TITLE>Work Web</TITLE>
</HEAD>
<BODY BACKGROUND="wwbg1.gif" LINK=BLACK VLINK=BLACK ALINK=WHITE>
<FONT FACE="Verdana,Helvetica">
<IMG SRC="ww1.gif">
<BR><BR><BR><BR><BR><BR>
<TABLE CELLPADDING=10 CELLSPACING=10 BORDER=0 WIDTH="100%">
<TR>
<TD VALIGN=TOP>
<FONT FACE="Verdana,Helvetica">
# select all of the data in the "jobs" table
&sql("SELECT * FROM Jobs")
{
&assign(?ptot?,?recordsetsize?/?categorysize?)
# only create job pages & links if the database
# actually contains some vacancies!
&if(?recordsetsize?>0)
{
<FONT SIZE="+2">Select a link:</FONT>
<UL><UL>
# repeat this block as long as there is still data
# to process
&loop(?recordsetsize?>?rownumber?)
{
&assign(?var1?,?rownumber?+?categorysize?-1)
<A HREF="content?pagenum?.html">Jobs ?rownumber?-?var1?</A><BR>
# create a page with ?categorysize? number of
# jobs on it (by calling subroutine &datapage)
&datapage
}
</UL></UL>
}
# if there's no data in the database, print a sorry message
&else
{
<FONT SIZE="+2">Sorry!<BR>The database is currently empty.</FONT>
}
}
</FONT>
</TD>
<TD WIDTH="45%" VALIGN=TOP><FONT FACE="Verdana,Helvetica">
<B>This Site</B> demonstrates the use of GDI's Database
publishing software. A database consisting of
a large table of jobs is broken down into manageable
chunks before being merged with the web site
HTML and passed to the web server <I>automatically.</I>
</FONT>
</TD>
</TR>
</TABLE>
<BR><BR><BR>
<TABLE CELLPADDING=10 CELLSPACING=10 BORDER=0 WIDTH="100%">
<TR>
<TD>
<FONT FACE="Verdana,Helvetica">
<B>System Bullet points:</B>
<UL>
<LI> Totally automated publishing of database and spreadsheet data using a dial-up Internet connection.
<LI> The database does not need to be stored on the web server.
<LI> No specialist knowledge is required by web site maintainer.
<LI> Zero administration overhead- Just set the times/days when you
want to update your web site from your database and forget it!
</UL>
</FONT>
</TD>
</TR>
</TABLE>
<CENTER>
<FONT FACE="Helvetica">
<BR><BR>
<I>Web site design by:</I><BR>
<A HREF="http://www.gd-ind.com/">GLOBAL DATA INDUSTRIES</A>
</FONT>
</CENTER>
</FONT>
</BODY>
</HTML>
}
##########################################################
# Print finished message & dialog
&msgbox("Script finished!")
&cls
&print("HTML generation complete. Click the Preview HTML button to view the results.")
&print
&print
# END OF SCRIPT
##########################################################
# SUBROUTINES
############################################################
# The following subroutine is used to generate the DATA HTML
# pages (The pages linked to the top-level page)
&defsub("datapage")
{
# Print progress message
&print("Processing Jobs ?rownumber?-?var1?")
&html("content?pagenum?.html")
{
<HTML>
<HEAD>
<TITLE>Jobs ?rownumber?-?var1?</TITLE>
</HEAD>
<BODY BACKGROUND="wwbg1.gif" LINK=BLACK VLINK=BLACK ALINK=WHITE>
<FONT FACE="Verdana,Helvetica">
<TABLE WIDTH="80%" CELLSPACING=10 BORDER=0>
<TR>
<TD><IMG SRC="wwbullet1.gif"></TD>
<TD>
<FONT SIZE="+3" FACE="Verdana,Helvetica">
Jobs ?rownumber?-?var1?
</FONT>
</TD>
</TR>
</TABLE>
<UL><UL>
<BR>
# print out the job details, the max. number of jobs
# that will be put on each page is set by ?categorysize?
&foreachrow(?categorysize?)
{
<B>?JobTitle?</B>
<BR>
<TT>?JobDesc?</TT>
<BR><BR><BR>
}
# this bit of script code adds the links to pages 1,2,3 etc
&repeat(?lcount?,?ptot?+0.5)
{
# the current page number is printed in red & is not a link
&if(?pagenum?==?lcount?)
{
<FONT COLOR="Red">?lcount?</FONT>
}
&else
{
# all other pages are printed as links
<A HREF="content?lcount?.html">?lcount?</A>
}
}
# this bit of script adds previous/next links. it's conditional,
# they are only added if there actually are previous/next pages.
&if(?pagenum?!=1)
{
&assign(?tmp?,?pagenum?-1)
<A HREF="content?tmp?.html">Previous</A>
}
&if(?pagenum?<?ptot?)
{
&assign(?tmp?,?pagenum?+1)
<A HREF="content?tmp?.html">Next</A>
}
</UL></UL>
</FONT>
</BODY>
</HTML>
# this variable is used as the page count, and is incremented
# after each page.
&inc(?pagenum?)
}
}