Unitary: An Ajax based Units Converter Sidebar Widget for WordPress

A brief intro…

This sidebar widget serves as a quick Units Conversion tool – i.e. perform conversions Unitary Screenshotbetween various units of length, area, volume, speed etc., while sitting smugly in the sidebar of widget enabled WordPress blogs. This widget came in rapid succession of curreX (the Currency Converter) and the idea came off a comment by David Bradley at the Weblog Tools Collection blog. Since I’m fairly new to WordPress widget development, I thought why not try my hands at this… and here I am with the first stable release of the same.

Just of a side-note, my venture into the whole PHP-JavaScript-AJAX scene is quite recent. Till now I’d limited myself to mainstream coding on .NET. I find this all new journey really enlightening and am pretty proud of myself at having been able to churn out perfectly working some cool-tools, starting entirely from scratch. Thanks to all those who’ve provided me with ample encouragement to take a steady step in this direction. Once again, as always, I am not perfect. I cannot stress on the fact how important your comments & feedback are in order for me to carry on further with such development work.

Current Version

  • 0.5

Features

  • Converts between hundreds of common & uncommon Units of Length, Area, Volume, Weight / Mass, Speed etc. More unit types to be announced in future.
  • Operates in Basic and Extended mode (which can be set from the Sidebar Widgets Control Panel of WordPress). The Basic mode limits the conversions to the more common & well-known units – thus making it more intuitive and user-friendly. However, the Extended mode makes available for conversions, a far wider array of units (including loads of lesser-known ones). This is meant for blogs which cater to a more scientifically advanced audience.
  • Precision (number of digits after Decimal Point) can be fixed for the converted results.
  • It employs an AJAX back-end, i.e. the conversions are performed without having to refresh the whole page, making the tool really lightweight & fast. Looks cool too.

Requirements

Download

[download id=”4″]

Installation

Installation couldn’t get any easier. Once downloaded, simply…

  1. Copy the extracted folder named curreX into your WordPress plug-ins folder.
  2. Activate the plug-in from the Plug-in Manager in WordPress.
  3. Visit the Sidebar Widgets page under Presentation menu to drag & drop the widget onto any sidebar you desire.

That’s it!

Showcase (the widget in action)

Subversion Repository

Change Log

  • Version 0.5 (2007-03-22)
    • Fixed an Internet Explorer specific bug that caused the units selection drop-down boxes to become blank (unfilled with any unit data) when a unit type was chosen from the first drop-down. The widget now works uniformly across both Internet Explorer & Firefox. All thanks to Náiron J. C. G for the IE-DOM+JavaScript based solution.
  • Version 0.4 (2007-03-15)
    • Fixed a minor bug that caused incorrect version reporting in WordPress plug-ins management panel.
  • Version 0.3 (2007-03-15)
    • Made minor adjustments in the layout of the plug-in resulting in smoother cross-browser rendering.
    • Renamed a bunch of plug-in related variables to avoid name collision with other plug-ins.
  • Version 0.2 (2007-03-14)
    • Included prototype.js with this distribution – as the plug-in wasn’t functioning properly on non-prototype based themes.
    • Fixed minor layout problems of fixed width form fields which was causing the layout to be distorted under different resolutions (read Sidebar width).

Please Note

I offer support for my plug-ins via the Chaos Laboratory Support Forum only. I will NOT respond to support queries left in the comment section below and, in most cases, will also not publish them. Of course, if you’d like to say something nice or helpful, then feel free to leave a comment!

curreX: AJAX Based Currency Converter Widget for WordPress

A brief intro…

Past few weeks I’ve been extremely busy designing a Property Investment site for a client. The primary requirement was a custom CMS (Content Management System) – which I had to build from scratch. While it drove me over the edge at times overall it was a thoroughly curreX Screenshotenjoyable as well as an educational journey for me. Since this is a site that caters to foreign investors, one of the requirements was a Currency Conversion Calculator which could be embedded in any of the articles thus providing the visitors an opportunity to get an idea of the property prices in their native currencies, without having to leave the page. At first I sought the easy way out – i.e. I searched far & wide for a currency calculator service that’d allow me to convert between almost any of the world currencies. Unfortunately the free ones out there are really pathetic and the my client wasn’t willing to shell out any $$ for a paid service. That got me down to designing one on my own. I’ve been dabbling in AJAX for a while now and find the whole idea of RIA (Rich Internet Application) really attractive. So I decided to walk the AJAX way and came up with this cool-tool. Once done with the main project, I was so satisfied with the result that I thought it’d be a really good idea to convert it into a sidebar widget for WordPress. So here I am, with curreX – the Ajax based Currency Converter for WordPress.

Current Version

  • 0.9

Features

  • The widget is very simple and does exactly what it’s supposed to do. It accepts a currency value (integer or decimal) and a source & destination currency and gives you the converted rate once you hit the Convert button.
  • It employs an AJAX back-end, i.e. the conversions are performed without having to refresh the whole page, making the tool really lightweight & fast. Looks cool too.
  • Performs client-side validation of the amount entered – thus cutting out chances of entering an erroneous value and crashing the calc. midway while performing a conversion.

Requirements

Download

[download id=”3″]

Installation

Installation couldn’t get any easier. Once downloaded, simply…

  1. Unzip the archive.
  2. Copy the extracted folder named curreX into your WordPress plug-ins folder.
  3. Activate the plug-in from the Plug-in Manager in WordPress.
  4. Visit the Sidebar Widgets page under Presentation menu to drag & drop the widget onto any sidebar you desire.

That’s it…

For those who’re using curreX with non-widget-enabled themes, you should insert the function
< ? show_currex( default_from, default_to, decimal_places, type, title ); ?>
in an appropriate place. For further details on this function & it’s parameters, refer to the FAQs section of the readme.txt bundled in the distribution.

Demonstration

A live demonstration of this can be found under the Coding section of my blog. Though the implementation of the demo is slightly different (it’s hard-coded into in a page), it should give you an idea on what the widget can do.

Showcase (the widget in action)

  • GoBackpacking
  • Hua-Hin Live – A customised version of the plug-in can be seen in action in the property list pages, once you’ve searched for properties

Subversion Repository

Change Log

  • Version 0.9 (2008-06-22)
    • Added Flash based Widget support. Now one has the option of choosing between the HTML/JavaScript version or the Flash version from the widget configuration panel of WordPress.
    • The structure of the show_currex() function (for non widget-enabled themes) has changed slightly too – to support embedding of the flash widget.
  • Version 0.8 (2008-06-19)
    • While releasing version 0.7 I had made some changes in the path structure (reference to any additional files that were loaded in the background) – and I messed up a bit there. As a result, the core javascript module that fetched the conversion rates and performed the calculations wasn’t loading properly.
    • Fixed some minor CSS issues. Now the look & feel of the widget can be modified in its entirety through the accompanying CSS file.
  • Version 0.7 (2008-05-16)
    • Added the functionality to display curreX in non-widget-enabled themes too (by popular demand). Till version 0.6, this plug-in could only be used in the form of a widget with widget-enabled themes.
  • Version 0.6 (2008-05-11)
    • This is a complete port to jQuery. Decided to finalise on one ajax library and jQuery emerged the winner. No more Protoculous for me.
    • Split out the styling into a separate CSS file. Anyone with even a bit of CSS knowledge, can now easily alter the looks of the widget without having to touch the core code file(s).
    • Implemented BlockUI – a jQuery plugin that blocks the widget interface while performing a currency conversion routine (ajax based).
    • Included a HELP option, that leads directly to the Chaos-Lab Forums (curreX Subforum)
  • Version 0.5 (2007-09-21)
    • Minor fix – but at the same time a major one from the perspective of functionality. The back-end URL for fetching conversion data from Yahoo! Finance had changed from finance.yahoo.com to download.finance.yahoo.com. This caused the plug-in to generate a message saying “Error contacting Yahoo! Finance” and not work at all. Thanks to Lia Johnston for pointing me to the correct URL.
  • Version 0.4 (2007-03-15)
    • Fixed a minor bug that caused incorrect version reporting in WordPress plug-ins management panel.
  • Version 0.3 (2007-03-15)
    • Bundled prototype.js library along with the distribution instead of relying on a theme to have it. This way the latest version of prototype can always be bundled along with.
    • Made some minor changes in the layout for smoother functionality & improvement of looks.
    • Renamed a bunch of plug-in related variables to avoid name collision with other plug-ins.
  • Version 0.2 (2007-03-05)
    • Fine tuned the widget. Now the currency unit values are written off an array instead of the ungainly manual approach that was being used earlier on. This reduced the file-size of the main plug-in considerably despite adding new code.
    • Added the configuration section. One can now set the default currency units to be displayed when the widget loads (from & to).
    • Added a Decimal Place option, which defines the number of decimal places to show in the converted result.

Please Note

I offer support for my plug-ins via the Chaos Laboratory Support Forum only. I will NOT respond to support queries left in the comment section below and, in most cases, will also not publish them. Of course, if you’d like to say something nice or helpful, then feel free to leave a comment!

If you find this plug-in useful, please consider making a donation towards further development of this useful little utility.


Alternatively, you can help me by reviewing this post by clicking on the following link. Believe it or not, this will help us both earn some cash from PayPerPost.