w3HtmlInsertSection

Syntax   Parameters   Example Programs

w3HtmlInsertSection inserts HTML code from the named item into the page being built. Within the template there are three ways to modify the results. These modifications are applied in the following order:

  1. Include files which are inserted into the template as the template is processed.

  2. Begin/End blocks indicating which part of the template to use.

  3. Section names to indicate which subsection of the template to use.

Include files

All include files specified in a template file are expanded before any other evaluation takes place. Include files are evaluated depth first and can be nested to an unspecified limit (testing has gone to 15 levels). An include file is added to a template by using the following syntax in the template:

<!--w3Include filename itemname-->

or

<!--w3Include itemname-->

or

<!--w3Include accountname,filename, itemname-->

or

<!--w3Include dos:drive:\directory filename-->

In the second example, the included template is read from the current template source file (usually w3Html. The syntax must be used exactly as shown, with no spaces before or after the dashes "--" in the HTML tag.

If an expansion error occurs, such as the include file cannot be read, or a nesting loop is detected, or the source file does not exist. An error is logged to the w3Logs,flashconnect file and nothing is output.

Begin/End blocks

After all templates are fully expanded, the part of the fully expanded template inside of the of the first BEGIN/END block is used. If there is no BEGIN/END block, the entire template is used. A BEGIN block starts with the text "##BEGIN##" and ends with the text "##END##". For most applications, using Section names is preferred over using BEGIN/END blocks.

Excluded

##BEGIN##

Inserted HTML

##END##

Excluded

Section names

You can insert part of a template by naming each logical section of the template. A section is indicated by bracketing it with section markers. There is a section marker at the beginning and end of each section. If the specified section does not exist, nothing is used. If no section name is specified (the section parameter is "") the entire template is used. A section marker pair looks like:

<!--sectionname-->

<!--/sectionname-->

For example, if you use the following call:

call w3HtmlInsertSection("xyz.html","", "first")

... the xyz.html item looks like this:

<!--first-->

Inserted HTML

<!--/first-->

<!--second-->

not inserted

<!--/second-->

Only the text "Inserted HTML" is included.

A template can contain more than one section, however, each section within a template must have a unique name.

Unless debugging is enabled, the last template used is cached. Requests for non-existing templates are logged in the w3Logs,FlashCONNECT file.

Syntax  

call w3HtmlInsertSection  (id , sub , section )  

Parameters

id

In

The item-id of the HTML to insert.

sub

In

The substitution matrix. See w3HtmlParse for more information.

section

In

The name of the section to insert.

 

Example Programs

w3Admin.w3Config.form

programming.bas9d

programming.bas10

programming.bas1

MTSelectPayment

w3Admin

programming.bas2

MTDecline

programming.bas3

MTAccept

programming.bas4

w3Admin.InsertErrors

w3Admin.w3Apps.create

programming.bas5

programming.bas6

InsertSections

TemplateInsertTest

MTPayment

w3Admin.w3Apps.Maintain

wbp-doc-html

programming.bas7

w3Admin.w3Groups.form

w3Admin.w3LogsControl.form

w3Admin.w3Apps.Update

programming.bas9a

w3Admin.w3User.form

Xlate1

programming.bas8a