World Site Index

:  

World Site Index Blog / Blog article: Currency converter

Currency converter

With submissions coming from all over the world we felt that we needed to give people the option to see the cost of an express submission in their own currency, and with ever increasing international trade a currency converter is always a useful tool.

So we added one to World Site Index.

We started looking at using existing converters and simply applying our skin to their code, however it quickly became apparent that these existing converters failed to even generate valid HTML 4 let alone XHTML, in one case the code generated by the converter was so poor that it broke our attempts to skin it. Frustrated with this we looked for raw data sources from which to build our own.

Having selected currency data feeds we set about building the required PHP scripts to power the converter and update it from the feeds.

On the currency converter page we chose to show a table of exchange rates as well as the main converter and for when we needed to show a currency conversion in a popup window we created a mini currency converter that can be opened with present values.

If you would like to make use of this mini converter yourself then please use the following code exactly:

<a title="Open currency converter in a new window" onclick="window.open(this.href, '_currency', 'height=430,width=400,resizable=no,toolbar=no,scrollbars=no,statusbar=no,menubar=no,locationbar=no'); return false;" href="http://business.worldsiteindex.com/currency/miniconverter.php">Currency Converter</a>

If you wish to pass an amount to convert, it’s currency and a default currency to convert to then you can pass the following parameters to miniconverter.php:

  • amount – The decimal amount to covert.
  • from – The 3 letter code for the currency being converted from.
  • to – The 3 letter code for the currency being converted to.

The following HTML will open the mini currency converter and covert the 11.00 GBP to AUD:

<a title="Open currency converter in a new window" onclick="window.open(this.href, '_currency', 'height=430,width=400,resizable=no,toolbar=no,scrollbars=no,statusbar=no,menubar=no,locationbar=no'); return false;" href="http://business.worldsiteindex.com/currency/miniconverter.php?from=GBP&to=AUD&amount=11">Currency Converter</a>

Will show as: Currency Converter

2 Responses to “Currency converter”

  1. Comment by Vince — July 21st, 2006 @ 9:46 pm

    Am I right in assumng the data is end of day data rather than by minute? Still a highly useful tool for rounding off though.

  2. Comment by Paul — July 21st, 2006 @ 10:19 pm

    Yes, at the moment the data is end of day, but eventually we would like to make it run from a live feed.

    In my experience currency conversion tools are only approximate, with the rate they show seldom being the same as the rate applied to say your credit card purchases.

Leave a Reply

World Site Index Blog is proudly powered by WordPress.

22 queries. 0.161 seconds.