Built into the MivaScript language is a "page template" compiler that can be used to build web pages
with a subset of the full Miva Script language. This compiler within a compiler is accessed through the
miva_template_compile(). This commands forms the
basis of the page template system used in Miva Merchant called
Store Morph Technology.
A page template is simply an html web page that contains language elements allowing a single template
to form the basis for many different web pages. When compiled, the template will render much faster than
similer systems that use an interpreted language like.
assign Executes an expression and saves the results to a variable.
comment Allows the addition of notes or block lines of code from compilation and execution.
eval Executes an expression and outputs the results directly to the page.
do Provides access to functions contained within external compiled Miva Script .mvc files.
call Uses the HTTP/1.1 protocol to emulate a browser and contact a remote or local host, posting or retreiving data.
if Use if to specify a block of code to be executed, if a specified condition is true
else Use else to specify a block of code to be executed, if the same condition is false.
else if Use elseif to specify a new condition to test, if the first condition is false.
Operators Use these to build expressions and are the same as Miva Script. They include
operators for arithmetic, comparison, logic, text/string, and bitwise operations,
Use conditional operators in if, else and endif expressions.
foreach Loops or iterates through each record in an array structure, providing each record for processing.
while While loops can execute a block of code as long as a specified condition is true.
<mvt:assign name="variable" value="expression, string, variable, function(), or number" />
Executes the expression contained within
value and saves that value to the variable defined in the name attribute.
name = any valid variable name prefixed with g. (global)
l. (local) or l.settings: (a template
value = The value can either be an expression, a string, a number, variable
or used in combination as shown below
literal stings = contained with single quotes (e.g. 'Bob ' $ 'White' )
numbers = a number or numeric expression (e.g. 2 * g.quantity)
There are some differences with the MvAssign tag. It does not support INDEX
or MEMBER attributes and the name variable can NOT be an array with a variable
as an index. This will fail. name="l.settings:products[ g.index ]:code"
Allows the addition of program notes and block lines of code from compilation and execution.
Comments are always ended with a closing comment tag and can span a single or multiple lines. Comments can not be nested.
<mvt:call action = "expression | 'literal'"
method = "'GET|POST|HEAD|XML|RAW|OPTIONS|PUT|DELETE|TRACE|CONNECT'"
content-type = "expression | 'literal'"
fields = " expression | 'variable list'"
files = " expression | 'literal'"
certfile = "expression | 'literal'"
certtype = "expression | 'literal'"
certpass = "expression | 'literal'"
timeout = "expression | 'literal'"
headers = "expression | 'literal'">
This example loads content from an external website and displays it on the page.
<mvt:call ACTION="'http://www.content_server.com/incude/X_Files_Cast.html'" METHOD="'GET'">
<mvt:eval expr= "s.callvalue " />
Uses the HTTP/1.1 protocol to
emulate a browser and contact (i.e. Call) a remote or local
host. HTML, XML, JSON and other pages can be requested from or
posted to the remote URI. Page data is returned one tag at a
time inside the loop.
Due to the number of attributes a available methods, it's best to
refer to the Miva Script documentation for a complete guide to this