HtmlBlock / End HtmlBlock

Takes two parameters, Location, Mode


Location, Mode
Location, ["Append"]
["Runtime"], ["Append"]


Use the HtmlBlock commands to allow for unescaped raw HTML inline with your MOX code, with the ability to swap out tags for field names from your Top Query, including conditional If tags.

HtmlBlock and HtmlBlocks are identical, except that HtmlBock is a Top Query command that operates a single time using Top Query field names, while HtmlBlocks is a Work Query command that operates once per record in the Work Query and uses Work Query field names, and optionally, Top Query fields as well.


Strings should be in double quotes, not single quotes, so that the single quotes can be used for trailing comments that will be stripped out like normal MOX code. Single quotes can however be used inside of the double quotes, for example, to help when embedding JavaScript.

Field names to be replaced should be wrapped in {{ }}. You can optionally reference field names by wrapping them in {[ ]}, which are replaced before the {{ }} field names.

Values from the Lang$ system can be referenced by wrapping the name in {$ $}

Although HtmlBlock does not have any parameters for Field Bases, these blocks will make use of WorkWith and TopWith values if they are set.

Content, including content that contains fields, may also be wrapped in conditional If / If Not / End If tags as shown in the example. If and If Not may only use simple bool tests, not complex tests. The scope of the field to be tested is determined by the type of brackets used for the If, just like the field names. If tags may not be nested, but an If tag for {{ }} may be nested inside of an If for {[ ]}, and visa-versa.

The use of End HtmlBlock is optional. A Procedure, a Private Method, or Private Function may set HtmlBlock at the beginning or near the top, and allow the rest of the code to be nothing but HTML.


The spaced shown at the start of these HTML tags are only here to enable them to be shown on this page.

    < div class="panel panel-default">  'Example Comment
        < div class="panel-heading">
            < h3 class="panel-title">{{pTitle}} - {[pCtg]} - {$Hello.World$}< /h3>
        < /div>
        < div class="panel-body">  'Another Comment
            {{If Not pContent}}< p>No content< /p>{{End If}}
        < /div>
    < /div>
End HtmlBlock