version 6.5 (Modified)
SEND HTML FILE (htmlFile)
Parameter | Type | Description | |
htmlFile | String | HTML Pathname to HTML file | |
or empty string for terminating SEND HTML FILE |
Description
The SEND HTML FILE command sends, to the Web browser, the Web page stored in the HTML document whose pathname you pass in htmlFile.
By default, 4D looks for the HTML document within the HTML root folder, defined in the application Preferences.
This command will only acccept path names in HTML syntax as a parameter: names of directories or folders must be separated with a slash ("/") regardless of the platform.
If you specify an invalid HTML pathname, 4D sends the message "The requested HTML page could not be found" to the Web browser.
The alternate syntax SEND HTML FILE(""), in which you pass an empty string in hmtlFile, allows you, in contextual mode, to terminate the call to SEND HTML FILE, which initiated the HTML mode. This is illustrated in the following diagram:
1. In contextual mode, a 4D Method (Project, Object or Database) issues a call to SEND HTML FILE, sending an HTML document to the browser.
2. The initial Web page sent to the browser may have HTML links to other Web pages or can itself refer to 4D Methods that call SEND HTML FILE to send other Web pages. These other pages may have links or refer to 4D Methods for accessing other pages, and so on. While navigating through the Web pages, you can also use browser's navigation controls, such as the Back button.
3. Any of the Web pages can include references to a 4D method that issues a SEND HTML FILE("") call. This call terminates the SEND HTML FILE call that initiated the whole thing, and you go back, pursuing the execution 4D Method that originally started the free Web navigation.
Once SEND HTML FILE is executed, the OK system variable is updated: if the file to be sent exists and if the timeout has not run out, OK is equal to 1. Otherwise, it is equal to 0.
Note: If you call SEND HTML FILE from within a process that is not a Web process, the command does nothing and returns no error; the call is simply ignored.
The references to 4D variables and 4DSCRIPTS type tags in the page are always parsed, whatever the mode.
Examples
1. The HTML root folder of the database is the WebDocs folder. It contains the following elements:
..\WebDocs\HTM\MyPage.HTM
Sending the Web page "MyPage.HTM" must be carried out in the following manner :
SEND HTML FILE ("HTM/MyPage.HTM")
2. Example in contextual mode:during a 4D Web session, you are adding records using a 4D form. In this form, there is a bHelp button, whose object method is as follows:
` bHelp button Object Method SEND HTML FILE ("Help.HTM")
Starting from the Help.HTM document, you can freely navigate between numerous HTML pages which implement the database Help system for your Web site. In each page, you have a submit button titled Done, which allows you to go back to data entry.
To do so, each of the HTML documents must contain the definition of this submit button:
<!-- bDone submit button --> <P><INPUT TYPE="submit" NAME="bDone" VALUE="Done"></P>
as well as the definition of the form post action:
<!-- Execute the 4D htm_Help_Done when a submit button is hit --> <FORM action="/4DMETHOD/htm_Help_Done" method="POST">
On the 4D side, the project method htm_Help_Done terminates the SEND HTML FILE initiated by the bHelp button:
` htm_Help_Done Project Method SEND HTML FILE ("")
The call to SEND HTML FILE in the object Method of the bHelp button is the last line of the method. When the method is completed, you return to data entry.
System Variables and Sets
If the file to be sent exists and if the timeout has not run out, OK is set to 1. Otherwise, it is equal to 0.
See Also
Binding 4D objects with HTML objects, SEND HTML BLOB, Your First Time with the Web Server.