Table of Contents
Compatible with DokuWiki
No compatibility info given!
This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.
|This plugin is Experimental!|
gil is a plugin I've developed for DokuWiki that performs a simple task: to show currency conversions in a wiki page.
For that purpose, conversion data made available by Yahoo Finances (™, (C) and/or whatever) is accessed and used to convert a singular amount of currency in an indicated (“source”) currency to a list of intended (“target”) currencies. The result is shown as a (X)HTML tooltip so that clients can hover over the amount and check the conversions.
This plugin is based off of work from Sridhar Kuppalli, a developer who in his blog shows the audience how to use PHP to access the currency data from the online service and use it for conversion. Credits and original idea therefore go to the man. I've just adapted the idea to work in DokuWiki because I thought the nature and intended use of this software may make a plugin like this useful.
Installation and Usage
Give the Install link above for the Plugin Manager to eat.
If the link doesn't work, check the Demo page which contains links.
To configure the plugin, just access the configuration manager and modify the following settings so that they suit your needs:
|Plugin Parameter||Default Value||Usage|
| || ||The source currency from which conversions will be performed.|
| || || A comma-delimited list of target currencies to which conversions will be performed,
and whose results will appear as the tooltip content. An example value would be:
| ||false|| Unused. If enabled, the ISO code of the source currency will be shown before the amount
for easier identification.
gil_targets use the National Currency Codes defined by ISO 4217 (three-letter currency codes). You can check here for the official catalogue, if you feel like you have the
gil money to buy, that is; or you can use the Wikipedia link provided above which contains a listing of National Currency Codes sorted by country.
To show currency conversions for a certain amount of national money, just precede it with two dollar signs, with no spacing whatsoever.
Optionally, introduce an alternative source unit as follows (take into consideration that this will incur in extra traffic and load overhead):
As a result, the text is shown in the form “… XXX$1500 …” with the text “YYY$nnnn” as the tooltip, where
XXX is the currency code used as source and
YYY the one used as target;
nnnn is the result of the conversion from the source 1500 units shown in the example to the target currency. See the picture below for an example.
- The plugin syntax takes no parameters.
- Configuration (now localized) is available via the Configuration Manager.
Note language is Spanish but online translators shall do a good job with it.
| An example visualization of the
(conversion from US Dollar to Euro)
Another demo site, very simple and in English: http://ryan.gulix.cl/tests/doku.php/gil
To show the conversions, a tooltip is implemented, which all browsers compliant to CSS 2.0 will be able to render. The plugin has been tested in Opera 10.10 and Firefox 3.0 without problems. If your particular browser (*ahem...*) renders incorrectly or not-at-all, it is a bug on their part – take the chance to switch to a better browser!
As of version 0.4, the plugin also implements the adequate CSS for print-preview, so the currency conversions are available when printing.
As with any of my plugins, there is no official Internet Explorer support, in particular for IE6 as part of the http://www.freelists.org/post/dokuwiki/end-of-IE6 end-of-IE6 devel campaign.
Upon loading (that is, once every time a page is requested), this plugin will try to connect to Yahoo Finances and, if it can not establish a connection, send a warning via DokuWiki's
msg function to let clients know that conversions may not show or may be out-of-date. The message is localized (but see Localization).
Each currency combination requires one data request to Yahoo Finances. That is, if you have conversions from Euro to Dollars, Euro to Yen, Pound to Yen and Sterling to Dollar, four requests will be made, no matter how many conversion instances you have in a page – you can have a spreadsheet complete with Over Nine Thousand currency conversions, but if they are all from Euro to Yen, only one request to Yahoo Finances will be made. Take this into consideration when using this plugin in a production environment rich in financial information or with limited traffic capabilities.
Remember this plugin is experimental.
What the plugin does is to retrieve currency conversion data live from Yahoo Finances. If you put too many conversions in a page or are trying to convert to many different currencies, page loading will be quite slow. Caching should not be affected.
For the moment, no caching whatsoever is implemented for the currency conversion data. Basic caching implemented in
Also for the moment, the plugin takes integer amounts for currency only. The plugin also takes fractional amounts, and can accept both period (
.) and comma (
,) as decimal separator.
The plugin does not currently check for the validity of currency units.
The plugin incorporates localized content for its description, configuration options and warning messages. However only English and Spanish messages are available. If you want to contribute a localization, submit it down here on Discussion or mail it to me. You will be credited accordingly and previous versions of the plugin will be retrofitted to include your contributions.
Download and unpack from the links above to get a view of the Source Code.
Things to Be Done
The following improvements are planned for the next release:
- Using the national currency symbol instead of the generic
- Verification of source currency validity 1).
- …Ability to use another service?
When will the major be released? Whenever it's ready.
Leave your 's here and I'll try to prove some 's. — Luis Machuca B. 2009/06/21 00:48
The currency shown in the text needs some CSS formatting, maybe a dotted underline so the web page user moves their mouse over.