mm - enable/disable automatic hit markup


<mm> ... $variables ... </mm>

<mm> and </mm> enable and disable, respectively, automatic hit markup of printed variables, after a query is set with fmtcp (here). This makes it easier to highlight the user's query terms across many result variables when printing a given search result, without having to search-and-replace each variable.

<mm> and </mm> have no effect on $ret.

In this example, the user's query is assumed to be in the variable $query, and we are printing one search result from that query, identified by $id. We use <mm> to auto-highlight the user's search terms across several fields (title, subject, description, etc.):


<fmtcp query "%mIH" $query>
Your query returned:
<SQL "select Title, Subject, Desc from books where id = $id">
    Title: $Title<BR>
    Subject: $Subject <BR>
    Description: $Desc
Other references:
<SQL "select Other, DontMark from sometable where id = $id">
  <mm>$Other</mm> $DontMark

Note that if just a single variable is to be marked up, it may be easier with a single <fmt> call (here):

Your query returned:
<SQL "select Title from books where id = $id">
  Title: <B><fmt "%mIH" $query $Title></B><BR>

without using <fmtcp>, <mm> and </mm>.

The mm statement was added in version 2.1.896840000 19980603.

Note that only variables are marked up: literal text is not, so that literal HTML formatting tags (e.g. <BR>) are not modified. Debug-syntax variable output ($?myVar etc.) is not marked up (in versions prior to version 7.07.1580929458 20200205, debug-syntax variables could cause errors). Force on/off HTML mode variable output ($+myVar/$-myVar) is marked up, but the +/- variable flag is ignored.

fmtcp, fmt strfmt, sb

Copyright © Thunderstone Software     Last updated: Oct 24 2023
Copyright © 2024 Thunderstone Software LLC. All rights reserved.