The HelloWorld example application displays Hello World on the browser. Since there is no user input required for this application to work, a static FlashConnect application is more appropriate than a dynamic application.
As with dynamic applications, use templates to create static Web pages. This example focuses on the use of WWW-PAGE, although the HelloWorld template is also used in the example below.
If you prefer to use templates, see Accounts, Files, Subroutines, Commands.
NOTE |
When the Web server and the database are located on separate systems, the static Web pages generated by the WWW-PAGE command must be moved to the Web server. Possible ways to accomplish this are: (1) Use a floppy disk. (2) Remotely mount the Web server’s directory onto the database. (3) Remotely mount a directory on the D3 system onto the Web server system. (4) Use FTP to transfer the files. When the Web server and D3 server are located on the same system, the directory can be used from within D3, placing the Web page generated by the WWW-PAGE command is directly into the WebServerHtmlDirectory. This is also true if a directory is remotely mounted and shared between the two systems. For more information about using super Q-pointers to link a D3 file to a host directory, see w3Html as well as the FlashConnect Programmer’s Online Reference. |
To create and run the static sample application:
Log to the www account.
Create a new application in the bp file called HelloWorld.html:
subroutine HelloWorld.html include www,wbp, w3include call w3HtmlInit('HelloWorld',"") call w3HtmlHeader("","") call w3Print("<P>Hello World!") call w3HtmlFooter("","") return |
Compile and catalog the application. For example:
compile-catalog bp HelloWorld.html |
Use the WWW-PAGE command to create the static page in the w3library directory. For example:
WWW-PAGE WebServerHtmlDirectory HelloWorld.html |
where WebServerHtmlDirectory is the path for the w3library on the Web server, or the path to a local Pick file (if the database server and the Web server are on separate machines).
As appropriate, update the permissions for the generated HTML.
Use the browser to display the page. The URL could be:
http://www.machine/path/HelloWorld.html
Lines 1 and 2:
subroutine HelloWorld.html include www,wbp, w3include |
These lines are required for all applications using FlashConnect. Every application is a subroutine that is called from WWW-PAGE (for static pages) or WWW-IRUN (for dynamic pages). The w3include item defines some named common areas for FlashConnect, as well as various constants.
Line 3:
call w3HtmlInit('HelloWorld',"") |
The template name (helloworld.headfoot.htm) initializes the HTML page and sets up the application or Web page name. The value passed is also used by the w3HtmlHeader and w3HtmlFooter routines to output a consistent set of Web pages.
Line 4:
call w3HtmlHeader("","") |
Processes the top portion of the template (the portion before ##CONTENT##).
Line 5:
call w3print("<P>Hello World!") |
Inserts the paragraph "Hello World!" into the Web page.
Line 6:
call w3HtmlFooter("","") |
Processes the bottom portion of the template (the portion after ##CONTENT##).
Line 7:
return |
Every FlashConnect application is a subroutine, and must return to WWW-IRUN when done.
See Also