There are dozens of MiniVend pre-defined tag functions. If you don't see
just what you need, you can use USER DEFINED TAGS
to create tags just as powerful as the pre-defined ones.
There are two styles of tag -- HTML/new, and old. Old style is a legacy from prior versions of MiniVend and is no longer in standard use, but its positional syntax can usually still be used in New/HTML mode for convenience.
In the new style, you can specify constructs inside an HTML tag:
<TABLE MV="if items"> <TR MV="item-list"> <TD> [item-code] </TD> <TD> [item-description] </TD> <TD> [item-price] </TD> </TR></TABLE>
The above will loop over any items in the shopping cart, displaying their part number, description, and price, but only IF there are items in the cart.
The same thing can be achieved with:
[if items] <TABLE> [item-list] <TR> <TD> [item-code] </TD> <TD> [item-description] </TD> <TD> [item-price] </TD> </TR> [/item-list]</TABLE> [/if]
To use the new more regular syntax by default, set the NewTags
directive to Yes
. The demo catalog is distributed with NewTags Yes
starting at MiniVend 3.07.
In most cases, tags specified in the old positional fashion will work the same in the new style. The only time you will need to modify them is when there is some ambiguity as to which parameter is which (usually due to whitespace), or when you need to use the output of a tag as the attribute parameter for another tag.
TIP: This will not work in the new style as it did in the old:
[page scan se=[scratch somevar]]
To get the output of the [scratch somevar]
interpreted, you must place it within a named and quoted attribute:
[page href=scan arg="se=[scratch somevar]"]
What is done with the results of the tag depends on whether it is a
container or standalone tag.
A container tag is one which has an end tag, i.e. [tag] stuff [/tag]
.
A standalone tag has no end tag, as in [area
href=somepage]. (Note that [page ...] and [order ..] are not container tags.)
A container tag will have its output re-parsed for more MiniVend tags by default. If you wish to inhibit this behavior, you must explicitly set the attribute reparse to 0. (Prior to MiniVend 3.09, reparse did not exist.) Note that you will almost always wish the default action.
With some exceptions ([include], [calc], [currency], and [buttonbar ..] among them) the output of a standalone tag will not be re-interpreted for MiniVend tag constructs. All tags accept the INTERPOLATE=1 tag modifier, which causes the interpretation to take place. It is frequent that you will not want to interpret the contents of a [set variable] TAGS [/set] pair, as that might contain tags which should only be upon evaluating an order profile, search profile, or mv_click operation. If you wish to perform the evaluation at the time a variable is set, you would use [set name=variable interpolate=1] TAGS [/set].
To use the new syntax only on a particular page, place one [new]
tag in your page. Likewise, to use old syntax when new is the default,
place one [old]
tag in the page.
If you have regions of the page which work under the old style and fail with the new style, you can surround them with [compat] [/compat] tag pair. This will evaluate that region only with the old style repeated interpolation.
NOTE WHEN USING THE OLD TAG PARSER (NewTags No) or [compat][/compat]: MiniVend in old mode interpolates tags in a highly ordered fashion, with each tag having a precedence. The order of the tag interpolation can be changed by enclosing the tag in a set of double square brackets, bringing it forward in the process. The order of interpolation is:
tag [[ANY TAG]] cart item-list loop default value scratch calc if lookup set data msql|sql file finish_order frames_on frames_off framebase body help buttonbar random rotate checked selected accessories field pagetarget area areatarget page last_page perl order nitems discount subtotal shipping shipping_description salestax total_cost price currency description row process_order process_search process_target