########################################################## # GDIdb demo script (c) 1997 Global Data Industries # Datasource=workweb.mdb (Access database) # # In this advanced example, the script creates a top-level # page from the contents of the categories table of the # database, with links to a series of pages listing the # headings of the jobs stored under each category. # Each of the job headings are hyperlinked to a html # document containing the actual job description. ########################################################## ########################################################## # Print the information screen &cls &print("WorkWeb Demo Script") &print("---------------------------------") ########################################################## # Name the ODBC datasource to be used. &datasource("Driver={Microsoft Access Driver (*.mdb)};DBQ=workweb.mdb") ########################################################## # this variable will be used when generating forward/backward # recordset links &defvar(?var1?) ########################################################## # Generate the top-level HTML file. &html("index.html") { Work Web





Select a Job Category:

# this SQL statement retrieves all of the jobs in the database. # the only reason it does this is so that the ?recordsetsize? # variable will contain the total number of jobs in the database. &sql("SELECT * FROM Jobs") { The Job database currently contains ?recordsetsize? vacancies.

(Updated from database on ?gdidbdate? at ?gdidbtime?)

}
    # loop through each of the categories, creating category # pages (by calling subroutine "jobcategory") and # links to them from this page. &getdata("SELECT * FROM Categories") { &print("Generating category ?JobCategory?") &sql("SELECT * FROM Jobs WHERE (((Jobs.JCatKey)=?JobcatKey?))") { # do the hyperlink to the job category page (?recordsetsize?) ?JobCategory[-1]?
    # followed by the file to link to # (created by subroutine jobcategory) &jobcategory } }
This Site demonstrates the use of GDI's Database publishing software. A relational database consisting of jobs grouped by job category is merged with the web site HTML and passed to the web server automatically.



System Bullet points:
  • Totally automated publishing of database and spreadsheet data using a dial-up Internet connection.
  • The database does not need to be stored on the web server.
  • No specialist knowledge is required by web site maintainer.
  • Zero administration overhead- Just set the times/days when you want to update your web site from your database and forget it!


Web site design by:
GLOBAL DATA INDUSTRIES
} ########################################################## # print the finishing message &msgbox("Finished!",iconinformation) &cls &print("Demo website HTML generation complete. Click the Preview HTML button to see the results.") &print # END OF SCRIPT ########################################################## # SUBROUTINES ########################################################## # subroutine jobcategory generates the category pages # that are linked to from the top-level page &defsub("jobcategory") { # the html file name for each of the job categories is generated # by combining the word "cat" with the row number of the job category in # the database. since the last &sql function called was to fetch data # from the jobs table, we put a [-1] at the end of the variable name # ?rownumber? to indicate that it belongs to the previous &sql function's # returned data. &html("cat?rownumber[-1]?.html") { Jobs List
?JobCategory[-1]?
} } ########################################################## # subroutine jobcontent generates the job content pages # that are linked to from the job category pages &defsub("jobcontent") { # the filename for the job content file is generated by combining # the rownumber of the job category (?rownumber[-1]?) with the # rownumber of the job. # note the 'n' placed between the two rownumber variables, this is # required to ensure a unique filename for the page. (think about it... #;-) ) &html("jfile?rownumber[-1]?n?rownumber?.html") { Job Description
?JobTitle?
Job ref: ?JobNo?

?JobDesc?


&if(?rownumber?>1) { &assign(?var1?,?rownumber?-1) Prev.
}
&if(?rownumber? }

\<-Home

} }