4.76. tag

4.76.1. Summary

Parameters: op arg

Positional parameters in same order.

The attribute hash reference is passed after the parameters but before the container text argument. This may mean that there are parameters not shown here.

Must pass named parameter interpolate=1 to cause interpolation.

This is a container tag, i.e. [tag] FOO [/tag]. Nesting: NO

Invalidates cache: no

Called Routine:

ASP-like Perl call:

    $Tag->tag(
        {
         op => VALUE,
         arg => VALUE,
        },
        BODY
    )

 OR

    $Tag->tag($op, $arg, $ATTRHASH, $BODY);

Attribute aliases

            description ==> arg
    [tag op arg other_named_attributes]
Parameters Description Default
arg   DEFAULT_VALUE
description Alias for arg DEFAULT_VALUE
op   DEFAULT_VALUE
Attributes Default
interpolate No
reparse Yes
attach_only No
Other_Characteristics  
Invalidates cache no
Container tag Yes
Has Subtags No
Nests No

Tag expansion example:

    [tag op arg]
---
    TODO: (tag result)

ASP-like Perl call:

   $Tag->tag(  { arg => VALUE_arg
                  op => VALUE_op
}, $body  );

or similarly with positional parameters,

    $Tag->tag(op,arg, $attribute_hash_reference, $body);

4.76.2. Description

Performs any of a number of operations, based on the presence of arg. The arguments that may be given are:

4.76.2.1. export database file* type*

Exports a complete Interchange database to its text source file (or any specified file). The integer n, if specified, will select export in one of the enumerated Interchange export formats. The following tag will export the products database to products.txt (or whatever you have defined its source file as), in the format specified by the Database directive:

    [tag export products][/tag]

Same thing, except to the file products/new_products.txt:

    [tag export products products/newproducts.txt][/tag]

Same thing, except the export is done with a PIPE delimiter:

    [tag export products products/newproducts.txt 5][/tag]

The file is relative to the catalog directory, and only may be an absolute path name if NoAbsolute is set to No.

4.76.2.2. flag arg

Sets an Interchange condition.

The following enables writes on the products and sizes databases held in Interchange internal DBM format:

    [tag flag write]products sizes[/tag]

SQL databases are always writable if allowed by the SQL database itself -- in-memory databases will never be written.

The [tag flag build][/tag] combination forces static build of a page, even if dynamic elements are contained. Similarly, the [tag flag cache][/tag] forces search or page caching (not usually wise).

4.76.2.3. log dir/file

Logs a message to a file, fully interpolated for Interchange tags. The following tag will send every item code and description in the user's shopping cart to the file logs/transactions.txt:

    [tag log logs/transactions.txt]
    [item-list][item-code]  [item-description]
    [/item-list][/tag]

The file is relative to the catalog directory, and only may be an absolute path name if NoAbsolute is set to No.

4.76.2.4. mime description_string

Returns a MIME-encapsulated message with the boundary as employed in the other mime tags, and the description_string used as the Content-Description. For example

   [tag mime My Plain Text]Your message here.[/tag]

will return

  Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
  Content-ID: [sequential, lead as in mime boundary]
  Content-Description: My Plain Text

  Your message here.

When used in concert with [tag mime boundary], [tag mime header], and [tag mime id], allows MIME attachments to be included -- typically with PGP-encrypted credit card numbers. See the demo page etc/report for an example. Adding the attribute attach_only=1 to the tag call will set the content disposition to "attachment" (vs. inline).

4.76.2.5. mime boundary

Returns a MIME message boundary with unique string keyed on session ID, page count, and time.

4.76.2.6. mime header

Returns a MIME message header with the proper boundary for that session ID, page count, and time.

4.76.2.7. mime id

Returns a MIME message id with the proper boundary for that session ID, page count, and time.

4.76.2.8. show_tags

The encased text will not be substituted for with Interchange tags, with < and [ characters changed to &#lt; and &#91; respectively.

    [tag show_tags][value whatever][/tag]

4.76.2.9. time

Formats the current time according to POSIX strftime arguments. The following is the string for Thursday, April 30, 1997.

    [tag time]%A, %B %d, %Y[/tag]

4.76.2.10. touch

Touches a database to allow use of the tag_data() routine in user-defined subroutines. If this is not done, the routine will error out if the database has not previously been accessed on the page.

    [tag touch products][/tag]

4.76.2.11. arg

4.76.2.12. op