NAME
AxKit::XSP::Currency - Currency formatting and conversion taglib
VERSION
$Id: Currency.pm 299 2005-03-05 01:15:21Z claco $
SYNOPSIS
Add this taglib to AxKit in your http.conf or .htaccess:
AxAddXSPTaglib AxKit::XSP::Currency
Add the namespace to your XSP file and use the tags:
<xsp:page
language="Perl"
xmlns:xsp="http://apache.org/xsp/core/v1"
xmlns:currency="http://today.icantfocus.com/CPAN/AxKit/XSP/Currency"
>
<currency:format code="USD" options="FMT_STANDARD">19.5</currency:format>
<currency:format>
<currency:code>USD</currency:code>
<currenct:options>FMT_HTML</currency:options>
<currency:price>10.95</currenct:price>
</currency:format>
DESCRIPTION
This tag library provides an interface to format and convert currency within XSP pages.
This initial version currently only supports currency formatting. Currency conversion is planned for future releases.
TAG HIERARCHY
<currency:format code="USD|CAD|..." options="FMT_STANDARD|FMT_COMMON|...">
<currency:code></currency:code>
<currency:options></currency:options>
</currency:format>
TAG REFERENCE
<currency:format>
Given a price, usually in decimal form, format returns a formatted price using the various options in Locale::Currency::Format
.
<currency:format>10.9</currency:format> # prints &#x0024;10.50
Attributes
The format
tag has two available attributes to control the output:
- code
-
This is the 3 letter currency code used to specify the currency in use. The
code
attribute can also be specified using a child tag instead:<currency:format> <currency:code>USD</currency:code> </currency:format>
USD
is used as the default if no currency code is specified. See Locale::Currency::Format for all of the available currency codes. - options
-
This is a string containing the formatting options to be used to specify the desired output format. The
options
attribute can also be specified using a child tag instead:<currency:format> <currency:options>FMT_STANDARD | FMT_NOZEROS</currency:options> </currency:format>
FMT_HTML
is used as the default if no options are specified. See Locale::Currency::Format for all of the available format options.
SEE ALSO
AUTHOR
Christopher H. Laco
CPAN ID: CLACO
cpan@chrislaco.com
http://today.icantfocus.com/blog/