Comments#
MivaScript comments inside your script allow you to explain the code, making it more readable. Comments must be closed with a corresponding closing tag and can span a single line or multiple lines.
Syntax#
<MvCOMMENT>...comment text...</MvCOMMENT>
Examples#
Single-line comment#
<MvCOMMENT>The code below will output the year.</MvCOMMENT>
<MvEVAL EXPR="{ s.tm_year }">
Multi-line comment within a function#
<MvFUNCTION NAME="Sum" PARAMETERS="var1,var2" STANDARDOUTPUTLEVEL="">
<MvCOMMENT>
This function adds two numbers.
Rounded to the nearest whole number.
</MvCOMMENT>
<MvFUNCTIONRETURN VALUE="{ (l.var1 + l.var2) ROUND 0 }">
</MvFUNCTION>
Ignored by the compiler#
The content of a comment is ignored by the compiler and is not passed on to the browser. This makes comments useful for debugging and testing your program. By surrounding blocks of code with comments, you can isolate and locate sections with problems.
Example: Isolating a bug
<MvFUNCTION NAME="Divide" PARAMETERS="var1,var2" STANDARDOUTPUTLEVEL="">
<MvCOMMENT>
There is a problem in here somewhere.
<MvFUNCTIONRETURN VALUE="{ l.var1 / 0 }">
</MvCOMMENT>
</MvFUNCTION>
HTML comments#
You can also use ordinary HTML comments. These are passed to the browser but not displayed. MivaScript within HTML comments are still processed allowing you to embed test script that shows up in the source but not on the display.
Example: HTML comments with MivaScript#
<MIVA STANDARDOUTPUTLEVEL="mvt, text, compresswhitespace">
<!-- Order_Date = <MvEVAL EXPR="{ g.order_date }"> -->
</MIVA>