HTML General Purpose Procedures

An SQR program without HTML procedures has limited HTML capabilities; therefore, adding HTML procedures to an SQR program enhances the appearance of the HTML output.

See Generating HTML Output.

The following table describes HTML general purpose procedures:

Procedure

Description

html_br

Produces the specified number of line breaks in a paragraph by using the HTML<BR> tag. The paragraph continues onto the next line.

Syntax:

html_br(number count, string attributes)

Count: The number of HTML <BR> tags that are inserted.

Attributes: The HTML attributes that are incorporated inside the HTML <BR> tag.

Example:

print 'Here is some text' () 
do html_br(3,'') 
print 'Here is some text three lines down' ()

html_center

Marks the start of text to be centered in the HTML document by using the HTML <CENTER> tag. You can also accomplish this by using the SQR print statement with CENTER specified in the code.

Syntax:

html_center()

Attributes: The HTML attributes that are incorporated inside the HTML <CENTER> tag.

Example:

do html_center(‘’) 
print ‘Here is some centered text’ () 
do html_center_end 

html_center_ end

Marks the end of text that was previously specified as centered.

Syntax:

html_center_end 

html_hr

Produces a horizontal divider between sections of text by using the HTML <HR> tag.

Syntax:

html_hr(string attributes)

Attributes: The HTML attributes that are incorporated inside the HTML <HR> tag.

Example:

print 'Here is some text' () 
do html_hr('') 
print 'Text after a horizonal divider' () 

html_img

Inserts an image by using the HTML <IMG> tag. You can also do this by using the PRINT-IMAGE command; however, the html_img procedure enables you to specify the full set of available HTML attributes.

Syntax:

html_img(string attributes)

Attributes: The HTML attributes that are incorporated inside the HTML <IMG> tag. Some common attributes include:

  • src: The URL of the image to be inserted.

    Example: src=/images/abc.gif

  • height: The height of the image in pixels.

    Example: height=200

  • width: The width of the image in pixels.

    Example: width=400

Example:

do html_img('src="/images/stop.gif"') 

html_nobr

Marks the start of text that cannot be wrapped by using the HTML <NOBR> tag.

Syntax:

html_nobr

Example:

do html_nobr('') 
print 'Long line of text that shouldn't wrap' () 
do html_nobr_end 

html_nobr_end

Marks the end of text that cannot be wrapped by using the HTML </NOBR> tag.

Syntax:

html_nobr_end

html_on

Activates the HTML procedures. Call this procedure at the start of an SQR program; otherwise, the HTML procedures are not activated. After the HTML procedures are activated, format the appearance of the web page by using the various HTML procedures.

Syntax:

html_on

Example:

do html_on 

html_p

Marks the start of a new paragraph by using the HTML <P> tag.

Syntax:

html_p(string attributes)

Attributes: Defines the HTML attributes that are incorporated inside the HTML <P> tag. A common attribute is align = left|right|center, which specifies the alignment of the paragraph.

Example:

do html_p('ALIGN=RIGHT') 
print 'Right aligned text' (1,1) 
do html_p_end 
print 'Normally aligned text' (+1,1) 

html_p_end

Marks the end of a paragraph by using the HTML </P> tag. The end of a paragraph is typically implied and the procedure is technically not needed; however, specifying it for completeness is a good practice.

Syntax:

html_p_end 

html_set_body_attributes

Specifies the attributes that are incorporated into the HTML <BODY> tag. Call this procedure at the start of the SQR program.

Syntax:

html_set_body_attributes(string attributes)

Attributes: Defines the HTML attributes that are incorporated inside the HTML <BODY> tag. Some common attributes include:

  • background: Specifies the image to display in the background of the web page.

    Example: background=/images/logo.gif

  • bgcolor=#rrggbb: Specifies the background color of the web page.

    Example: bgcolor=#80FFF

Example:

do html_set_body_attributes('BACKGROUND="/images/x.gif"')

html_set_head_tags

Specifies the tags that are incorporated between the HTML <HEAD> and </HEAD> tags. These tags are empty by default. One common tag to set is the HTML <TITLE> tag, which specifies the title to display for the web page. Call this procedure at the start of the SQR program.

Syntax:

html_set_head_tags(string attributes)

Attributes: Defines the HTML attributes that are incorporated between the HTML <HEAD> and </HEAD> tags.

Example:

do html_set_head_tags('<TITLE>My Report</TITLE>')