Index  Up  <<  >>  


DATA and FIELD

The [data ...] and [field ...] tags access elements of MiniVend databases. They are the form used outside of the iterating lists, and can be effectively used to do lookups when the table, column/field or key/row is conditional based on a previous operation.

The following are equivalent for attribute names:

    base  ---> table --> database
    name  ---> field --> column --> col
    code  ---> key   --> row
[data area field key "value"* increment*]
named attributes: [data base="database" field="field" key="key" value="value" op="increment] )

HTML example: <PARAM MV=data MV.TABLE=database MV.COL=field MV.ROW=key>

Returns the value of the field in any of the arbitrary databases, or from the variable namespaces. If the optional value is supplied, the database value will be changed to it -- no ] characters may be present in the value unless using the new tag style. If the option increment* is present, the field will be atomically incremented with the value in value.

If a DBM-based database is to be modified, it must be flagged writable on the page calling the write tag. Use [tag flag write]products[/tag] to mark the products database writable, for example.

In addition, the [data ...] tag can access a number of elements in the MiniVend session database:

    accesses      Accesses within the last 30 seconds
    arg           The argument passed in a [page ...] or [area ...] tag
    browser       The user browser string
    host          MiniVend's idea of the host (modified by DomainTail)
    last_error    The last error from the error logging
    last_url      The current MiniVend path_info
    logged_in     Whether the user is logged in via UserDB
    pageCount     Number of unique URLs generated
    prev_url      The previous path_info
    referer       HTTP_REFERER string
    ship_message  The last error messages from shipping
    source        Source of original entry to MiniVend
    time          Time (seconds since Jan 1, 1970) of last access
    user          The REMOTE_USER string
    username      User name logged in as (UserDB)

Databases will hide variables, so don't name a database ``session'', ``scratch'', or any of the other reserved names or you won't be able to use the [data ...] tag to read them. Case is sensitive, so in a pinch you could call the database ``Session'', but it would be better not to.

[field name code]
named attributes: [field code="code" name="fieldname"]

HTML example: <PARAM MV=field MV.COL=column MV.ROW=key>

Expands into the value of the field name for the product identified by code as found by searching the products database. It will return the first entry found in the series of Product Files. the products database. If you want to constrain it to a particular database, use the [data base name code] tag.


Index  Up  <<  >>