[ic] Interchange Howto: Exchange Rate UserTag

Kevin Walsh kevin at cursor.biz
Thu Mar 10 11:26:21 EST 2005


Paul Rogers [paul at btsonline.co.uk] wrote:
> I've just finished a new [exchange-rate] UserTag for Interchange which
> will fetch, parse and display currency exchange rates and which I hope
> someone may find useful. 
> 
> The tag allows currency exchange rates to be fetched for Euros and US
> Dollars, with UK Pounds as the base
> currency, but can be adapted for any currencies. It can be used anywhere
> in your pages as follows: 
> 
> [exchange-rate USD] or [exchange-rate EUR]
> 
Thanks for posting your UserTag.  All such submissions are welcome.

I expect that people will probably need permission from Yahoo! Finance
if they want to use the results on a commercial website, but I could be
wrong.  It's probably best to check anyway.

The UserTag looks as if it could be easily modified to select the "from"
and "to" currencies, as well as the amount.  Converting from 1, as you
have done, makes sense if you just need to know the rate - perhaps when
performing multiple similar conversions on a single page.

I haven't tested your UserTag, but the use of "die" could cause
problems if the exception is tripped.  You could test that by changing
the URI to "http://www.example.com/", which will fail.  Perhaps it would
be better to use a zero (or undef) return code along with a suitable
message in a scratch variable.  Also, you don't need the "exit". :-)

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin at cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/



More information about the interchange-users mailing list