HtmlBlocks / End HtmlBlocks

Takes two parameters, Location, Mode

Description:

Use the HtmlBlocks 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 and/or Work 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.

Usage:

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

Example:

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

HtmlBlocks
    < div class="panel panel-default">  'Example Comment
        < div class="panel-heading">
            < h3 class="panel-title">{{Title}} - {[pCtg]}< /h3>
        < /div>
        < div class="panel-body">  'Another Comment
            {{Content}}
            {{If Not Content}}< p>No content< /p>{{End If}}
        < /div>
    < /div>
End HtmlBlocks

Details:

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 reference TopQuery field names by wrapping them in {[ ]}, which are replaced before the WorkQuery field names.

Although HtmlBlocks do 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 within the same query scope, but an If tag for {{ }} may be nested inside of an If for {[ ]}, and visa-versa.

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