Deniro Easily convert an amount between two currencies, using live exchange rate data.
Compatible with EE 1.
Free download.
Important Update: 30th June 2010
Deniro relies on the xurrency.com API for live exchange rate data. The xurrency.com API has recently been completely rewritten, breaking all “legacy” implementation, including Deniro.
You may still download Deniro and pick over its bones, but it no longer functions as described in this documentation. Deniro may, at some point, be updated to use the new xurrency.com API, but this is currently a very low priority task.
Requirements
Deniro requires PHP5.
Installation
- Extract the ZIP file.
- Copy
system/plugins/pi.deniro.phpto your/system/plugins/folder.
Usage
To convert an amount between two currencies, just add the plugin to your ExpressionEngine template, as follows:
{exp:deniro:convert amount='123.45' base='GBP' debug='yes' decimal_point='.' precision='2' target='USD' thousands_separator=','}
The convert method accepts the following parameters.
| Parameter | Description | Required? |
|---|---|---|
amount |
The figure to be converted from the “base” currency to the “target” currency. | Yes |
base |
The 3-letter currency code for the base currency. | Yes |
debug |
Set to ‘yes’ to receive detailed debugging information. Default value is no. | No |
decimal_point |
The single-character string to use as the decimal point. Default is a period. | No |
precision |
The number of decimal places to display. Default is 2. | No |
target |
The 3-letter currency code for the target currency. | Yes |
thousands_separator |
The single-character string to use as the thousands separator. Default is a comma. | No |
Checking if a currency is supported
Xurrency provides a full list of supported currencies. You can also check whether a currency is supported on-the-fly, using the is_supported helper function:
{exp:deniro:is_supported currency_code='GBP'} // true
{exp:deniro:is_supported currency_code='XXX'} // false
Debugging
By default, if the base or target currencies are unsupported, or amount is not a numeric value, an empty string is returned.
Detailed information about the cause of failure can be obtained by setting the optional debug parameter to “yes”. For example:
{exp:deniro:convert amount='123.45' base='GBP' debug='yes' target='XXX'}
License
Deniro is made available under a Creative Commons Attribution-Noncommerical-Share Alike 3.0 Unported License. What a mouthful.
In practical terms, this means that you can copy, adapt, and distribute Deniro as much as you like, provided that you:
- Credit the original author (that’s me, folks)
- Don’t use any part of Deniro in a commercial product
- License your code in a similar fashion, so others can continue to benefit from your work
Warranty
Deniro is released as-is, without any warranty, express or implied. The author (Stephen Lewis) will endeavour to offer support to those of you gracious enough to use his addon, simply because he’s an all-round good egg. Should he fall under a bus, or just become excessively busy, support may be slow, and perhaps even surly.
Finally, Stephen Lewis and Experience Internet are not responsible for any mishaps, catastrophes, disasters, spillages, data loss, or hair loss that may be caused by the installation or use of Deniro. It’s worked great for us, but your experience may differ.