For more information... RTFM!
NAVIGATION
RECENTLY VIEWED
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

PREFIX-calc

Summary

  • [PREFIX-calc] Perl code [/PREFIX-calc]

Description

Executes the Perl code given in the tag's body text.  This is equivalent to the [calc] tag, except that it's calculated at loop time instead of later, when the rest of the page is parsed.

The following example adds 2 to the current item's price (see [PREFIX-price]), and returns the result:

[PREFIX-calc] [PREFIX-price noformat] + 2 [/PREFIX-calc]

[PREFIX-calc] blocks may make use of a "$Row" hashref, which contains the current row data.  The following demonstrates the use of the "$Row" hashref:

[item-calc]
    if ($Row->{rip_off} eq 'Y') {
        return $Row->{weight} + 10;
    }
    else {
        return $Row->{weight};
    }
[/item-calc]
Warning

Warning

No changes will be made to the underlying table data if you make changes to the values in the "$Row" hashref.

Availability

Availability

The "$Row" hashref was introduced in version 5.3.2, and is therefore not available for use in any earlier Interchange version.

Category:  Looping tags and sub-tags
Last modified by: Peter Ajamian
Modification date: Thursday 13 December 2007 at 9:56 PM (EST)
Home  |  Legal nonsense  |  Privacy policy  |  Contact us