2.5. attr_list

2.5.1. Summary

Parameters: hash

Positional parameters in same order.

Pass attribute hash as last to subroutine: no

Must pass named parameter interpolate=1 to cause interpolation.

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

Invalidates cache: no

Called Routine:

ASP-like Perl call:

    $Tag->attr_list(
        {
         hash => VALUE,
        },
        BODY
    )

 OR

    $Tag->attr_list($hash, $BODY);

2.5.2. Description

Tags an attribute list with values from a hash. Designed for use in embedded Perl.

Example:

        [perl tables=products]
                my %opt = (
                        hashref => 1,
                        sql => 'select * from  products',
                );
                my $ary_of_hash = $Db{products}->query(\%opt);
                my $template = <<EOF;
{sku} - {description} - {price|Call for price}
        {image?}<IMG SRC="{image}">{/image?}
        {image:}No image available{/image:}
EOF
                foreach my $ref (@$ary_of_hash) {
                        $out .= $Tag->attr_list($template, $ref);
                }
                return $out;
        [/perl]

Tags according to the following rules:

2.5.2.1. {key}

Inserts the value of the key for the reference. In a database query, this is the column name.

2.5.2.2. {key|fallback string}

Displays the value of {key} or if it is zero or blank, the fallback string.

2.5.2.3. {key true string}

Displays true string if the value of {key} is non-blank, non-zero, or displays nothing if the key is false.

2.5.2.4. {key?} true text {/key?}

Displays true text if the value of {key} is non-blank, non-zero, and nothing otherwise.

2.5.2.5. {key:} false text {/key:}

Displays false text if the value of {key} is blank or zero, and nothing otherwise.