External Interfaces > RealWeb > RealWeb API > Writing a RealWeb Subroutine > The RealWeb Buffers

Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

RealityV15.1Online Documentation (MoTW) Revision 7

Two ways to Build your HTML (RealWeb) (build.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

Two ways to Build your HTML

The RealWeb Buffers

When your RealWeb subroutine completes, the contents of four buffers are used to construct the web page that is returned to the browser. These buffers are as follows:

RWC.OUTBUF This is the normal target of APIClosed routines that generate HTML directly. Note, however, that many routines write to or modify the contents of a string variable (see Subroutine Types below).

RWC.HEADBUF Routines that require HTML to be placed within the <head>  section of the HTML document append their output to this buffer. These include style definitions and imported stylesheets.

RWC.JSBUF Routines that directly generate JavaScriptClosed code, or import items that contain such code, append their output to this buffer so that all of this code can be grouped together in the final HTML document. When the HTML document is opened, the code in RWC.JSBUF is placed in suitable script tags and are copied into the <head>  section of the document along with the contents of RWC.HEADBUF.

RWC.ERRORBUF If errors are encountered at runtime during the execution of any of the RealWeb API routines, error messages may be generated. These messages are appended to RWC.ERRORBUF. The RWS_GET_BUFroutine allows the application to examine and modify the contents of any of the RealWeb buffers before it terminates. This gives you an opportunity to pick up any errors that may have occurred and to substitute standard error handling HTML pages as required.

Subroutine Types

The destination of the output from an API routine is determined by the type of the output and the type of the subroutine:

If you use the RWS_ and RWA_ routines to construct your HTML, you must use the RW_PUT routine to copy it to the output buffer. If another buffer would be more appropriate, use RW_PUT_EX and specify the buffer you require.

For example:

PARA = "Hello World!"
CALL RWS_PARA(PARA, "", "")
CALL RW_PUT(PARA)

This sets the PARA variable to the string "Hello World!", then formats it as an HTML paragraph and copies it to the output buffer.

Alternatively, you could use the following:

CALL RW_START_PARA("", "")
CALL RW_PUT("Hello World!")
CALL RW_END_PARA

In this case, the HTML to start a paragraph (<p>) is appended to the output buffer, followed by the text and then the end-of-paragraph tag (</p>).

These examples produce an identical result, but the first one would allow you to carry out further processing if required before committing the HTML to the output buffer.

 

RealityV15.1 (MoTW) Revision 7Comment on this topic