subroutine programming.bas8a
***********************************************************************
* Programming example 8a, using non-persistent connections
***********************************************************************
*
* [00] 02Nov00 jr Initial coding
include wbp w3Include
* prepare substitution strings for the header
* what ever substitutions the Web page designer places in
* the programming.subs file will be used here.
*
* For this example, programming.subs contains:
* $$TITLE$$=We're done
*
* this allows the Web page designer to change the FlashCONNECT
* flags and their substitutions without requiring any programming
* changes
substitutions = ""
call w3SubsGet("programming.subs", substitutions)
open "programming" to f.data else
call w3HtmlInit("", "")
call w3HtmlHeader("","")
call w3Printn("<HTML><BODY><H3>Application error</H3>")
call w3Printn("<P>Cannot open the file 'programming'")
call w3HtmlFooter("","")
return
end
* get name of heading banner
* we're using the logo list used in the rotating banner
* demonstrations, so it will be the name of a gif file
* however, people may think specifying a *.gif file is
* a bug, so as an extra, strip it out
heading = ""
call w3RotatorGet("w3Rotator.demo", heading)
heading = field(heading, ".", 1)
header = "**HEADING**":@VM:heading
* set up the HTML page
* Add a cookie to the page
* Cookie name is "programming"
* Cookie value is "set by us"
call w3HtmlCookie("programming=set by us","", "", "", "", "")
call w3HTMLInit("programming","") ;* use programming.headfoot.htm
call w3HTMLHeader("",substitutions)
call w3HTMLInsertSection("programming1", header, "head")
select f.data
subs = ""
done = 0
loop
readnext id else done = 1
until done do
readv addr from f.data, id, 1 then
subs<1> = "col1":@VM:id
subs<2> = "col2":@vm:addr
call w3HTMLInsertSection("programming1", subs, "detail")
* Write the w3ProfileId to the second field in the file
* this allows tracking of the last w3ProfileId which
* viewed this database entry
writev w3ProfileId on f.data, id, 2
end
repeat
call w3HTMLInsertSection("programming1", "", "end")
* Add the form to the Web page
*~<~FONT COLOR=RED~>~
* State that we want a non-persistent form and the
* name of the application to run when the form is submitted
* is programming.bas8b
call w3HtmlFormBeg(w3_NP,"programming.bas8b") ;* Start the form
*~<~/FONT~>~
call w3HTMLInsertSection("programming1", "", "form") ;* Add form body
call w3HtmlFormEnd ;* end the form
* Insert the template which includes another file
* we're using the entire file not sections of the file
call w3HtmlInsert("programming.include", "")
call w3HTMLFooter("","")
*~<~FONT COLOR=RED~>~
return
* All of this code was moved to the program which processes
* the Web page created here. Most significantly, the w3Input
* call is not used in non-persistent applications.
* Wait up to 5 minutes for the user's reply
* -----------------------------------------
*call w3Input(err, 600, "")
* Check for any error and just stop
* ---------------------------------
*if err # W3_OK then
* return
*end
*
* No error, get the value set by the user
* ---------------------------------------
*results = ""
*call w3GetVal(results, "like")
* Add the response to every record in the database
* ------------------------------------------------
*select f.data
*done = 0
*loop
* readnext id else done = 1
*until done do
* writev results on f.data, id, 3
*repeat
*
*close f.data
*return
*~<~/FONT~>~