Index  Up  <<  >>  


DEFAULT and LOOKUP

Sometimes you want to use a form value that the user has set, but want it to be initialized if not already present. The [default ...] tag will do that.

Other times, you want to initialize a variable based on a database value. The [lookup ...] tag will perform a lookup in an arbitrary database and set return that value only if the user form value is not set.

[default variable value*]
named attributes: [default name="variable" default="default value" set=1*]

HTML example: <PARAM MV=``default'' MV.NAME=variable MV.DEFAULT=``default'' MV. set=1>

Returns the value of the user form variable variable if it is non-empty. Otherwise returns default, which is the string ``default'' if there is no default supplied. Got that?

If the flag set is present and non-zero, then the variable will be set to the default and no value returned to the page. This allows you to initialize things like country, shipping mode, and other values on a checkout page.

[lookup table column row "a quoted value"]
named attributes: [lookup table="database" col="column" key=row value="[value name]"]

This is essentially same as the following:

    [if value name]
    [then][value name][/then]
    [else][data database column row][/else]
    [/if]


Index  Up  <<  >>