Format Currency
Component ID
949698
Component name
Format Currency
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Downloads
5899
Component created
Component changed
Component body
API module, used for displaying correctly formatted prices.
To use in your code;
- Where
$priceis a price. - And
$currency_codeis a CURRENCY CODE, eg. GBP or USD.
<?php print theme('format_currency', $price, $currency_code); ?>
The module also (optionally) integrates with the currency_api module, so if for example you wanted to show how many EUROS you'd have when exchanging GBP £100;
$baseindicates the base currency of the given price.- The
$currency_codeparameter is always the currency which will be shown.
<?php $price = 100; ?>
<?php $currency_code = 'EUR'; ?>
<?php $base = 'GBP'; ?>
<?php print theme('format_currency', $price, $currency_code, $base); ?>
NOTE: This module is a BETA release. Code-wise it is fine to use on production sites - it's in BETA as a lot of currencies do not have complete configuration yet and (unsurprisingly) the defaults do not suit every one... If you want to get involved, take a look at the format_currency.config.inc file and post your patches to the issue queue.
