Skip to content

MIVA#


Enables you to configure the level of output, error reporting, and error handling.

Syntax
<MIVA STANDARDOUTPUTLEVEL = "html, text, compresswhitespace"
      ERROROUTPUTLEVEL = "runtime | null string "
      ERRORMESSAGE = "text_of_error_message"
      MvTAGNAME_ERROR = "fatal | nonfatal, display | nodisplay">
      IDENT = "$Id: filename revision number date time author $"> 

Your script can contain multiple <MIVA> tags as needed, to turn features on and off. Each <MIVA> tag can specify one or more attributes. The STANDARDOUTPUTLEVEL and ERROROUTPUTLEVEL attributes can also be specified in user-defined functions (i.e. <MvFUNCTION>) giving you local control, or embedded within a function, allowing you for example, to enable and disable output to the browser for sections of script. When subsequent <MIVA> tags are encountered, and an attribute is omitted, the current setting for that attribute is assumed.

Attributes#

Attribute Description
STANDARDOUTPUTLEVEL Optional keywords: html, text, compresswhitespace. Specifies what displays in browser. If empty, output is suppressed unless explicitly output using the <MvEVAL> tag. By default HTML and text are output to the browser.
- html: HTML is output to the browser. Default.
- text: text (non html) is output to the browser. Default.
- compresswhitespace: will cause Miva Script to eliminate extra whitespace in the output of Miva Script code. Whitespace is leading and trailing spaces, tabs, and new lines.
ERROROUTPUTLEVEL Optional keywords: runtime, expression (deprecated), syntax (deprecated). If empty, error output is suppressed. If omitted, defaults to runtime.
- runtime: Specifies runtime errors display in the browser. Runtime errors occur when the script is executing. For example, using <MvIMPORT> on a file that does not exist.
- expression and syntax are unused in compiled Miva Script and are flagged by the compiler.
ERRORMESSAGE Optional global error message text displayed before standard error messages. If specified, this message will be displayed even if all forms of error reporting are turned off.
MvTAGNAME_ERROR Optional keywords: fatal
IDENT Optional. Used to add rcs-style ident tags (Revision Control System) to compiled Miva Script files in this form. $Id: filename revision number date time author $

Examples#

STANDARDOUTPUTLEVEL#

A Miva Script program typically consists of Miva Script tags, HTML tags, and text; including white space such as tabs and new lines between tags. Miva Script sends the results to the browser but you can designate what and how to send it by using the STANDARDOUTPUTLEVEL attribute. By default text and html are sent. Use compresswhitespace to minimize the output removing un-needed characters. A null string or any other word will suppress all output.

<MIVA STANDARDOUTPUTLEVEL="html, text, compresswhitespace">
Output <b>all</b> text and html.<br>

<MIVA STANDARDOUTPUTLEVEL="">
Suppress all output except for <MvEVAL>.
<MvEVAL EXPR="{ 'This gets output.' }">

ERROROUTPUTLEVEL#

The ERROROUTPUTLEVEL attribute allows you to enable or disable error reporting. By default runtime errors are reported.

<MIVA ERROROUTPUTLEVEL="runtime"> Runtime errors are displayed.

<MIVA ERROROUTPUTLEVEL=""> Suppress error reporting

ERRORMESSAGE#

You can specify a default error message that will be displayed before other, standard error messages. To do this, specify a value for the ERRORMESSAGE attribute. The default is the null string. If specified, this message will be displayed even if all forms of error reporting are turned off.

<MIVA ERROROUTPUTLEVEL="runtime"
      ERRORMESSAGE="Sorry I messed up! Please alert the network administrator.<br>">

MvTAGNAME_ERROR#

Whenever executing a Miva Script tag results in an error, the text of the error message is assigned to a variable that has the same name as the tag plus the _error suffix. This text is identical to the error message that the script displays by default in the browser window. For example, errors from <MvIMPORT> will be assigned to the global variable mvimport_error. Your script can test the contents of these variables and take some action based on the results of this test.

Configure the MvIMPORT_ERROR to continue the script without displaying the error.
<MIVA MvIMPORT_Error = "nonfatal, nodisplay">
<MvIMPORT FILE = "{ g.MerchantPath $ 'language.dat' }" FIELDS = "l.language" DELIMITER = "">
    <MvEVAL EXPR = "{ miva_setlanguage( l.language ) }">
    <MvIMPORTSTOP>
</MvIMPORT>
Re-Configure the MvIMPORT_ERROR to terminate the script and display the error message.
<MIVA MvIMPORT_Error = "fatal, display">

The following technique should be used to test the results of any database operation such as <MvQUERY>, <MvOPENVIEW>, <MvFIND> etc. to prevent Miva Script error messages from being displayed in the browser window, and allowing your script to take appropriate action.

Note

If the ERROROUTPUTLEVEL attribute exists, its runtime setting (whether present or absent) overrides the display/nodisplay setting made with TAGNAME_ERROR.

MvTAGNAME_ERROR variable#

<MvOPENVIEW NAME = "Merchant" VIEW = "Products" QUERY = "{ l.query }" FIELDS = "{ l.fields }">
<MvIF EXPR = "{ g.MvOPENVIEW_Error }">
    <MvFUNCTIONRETURN VALUE = "{ g.MvOPENVIEW_Error ) }">
</MvIF>

IDENT#

The IDENT attribute is used to add rcs-style ident tags (Revision Control System) to compiled Miva Script files in this form. $Id: filename revision_number date time author state locker $

<MIVA STANDARDOUTPUTLEVEL = "" IDENT = "$Id: merchant.mv 23822 2010-04-22 21:10:40Z burch $">