|
Enables you to configure the level of output, error reporting, and error handling.
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 are assumed. Attributes
Examples.A Miva Script program typically consists of Miva Script tags, HTML tags, and text; including white space such tabs and as 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. Used compresswhitespace to minimize the output removing un-needed characters. A null string or any other word will suppress all output. STANDARDOUTPUTLEVEL:<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.' }"> The ERROROUTPUTLEVEL attribute allows you to enable or disable error reporting. By default runtime errors are reported. ERROROUTPUTLEVEL:<MIVA ERROROUTPUTLEVEL="runtime"> Runtime errors are displayed. <MIVA ERROROUTPUTLEVEL=""> Suppress error reporting 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. ERRORMESSAGE:<MIVA ERROROUTPUTLEVEL="runtime" ERRORMESSAGE="Sorry I messed up! Please alert the network administrator.<br>"> 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. MvTAGNAME_ERROR: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> 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 $ IDENT:<MIVA STANDARDOUTPUTLEVEL = "" IDENT = "$Id: merchant.mv 23822 2010-04-22 21:10:40Z burch $"> |