Im Not Playing Any More
.. rantings and blog of Chris Williams @scampiuk
.. rantings and blog of Chris Williams @scampiuk
Most of the time you get what you pay for. It's something by now we've all experienced, a disappointing service or a product that just doesn't last or does a half-arsed job. The same thing isn't always true when it comes to online Video however...
How many times have you looked on one of your clients web sites - the site you've spend more than a few hours getting the template right, the content imported and the typography just right - only to find a huge image that's been shrunk down to under 100px?
We've moved maintenance of ExternalDB over to mkali.net, we recommend updating your bookmarks.
ExternalDB was created for internal use at HORIZONSolutions.tv to overcome a simple yet common problem - how to connect to an external database, or multiple external databases, for multiple components / plugins / modules without having to duplicate the connection details again and again.
We created a plugin, ExternalDB, which allowed us to set these connection details once and get on with it! Because of the kind of work we do we often have to query multiple databases to retrieve things like tournament information, player rankings and other such things that can't be moved into the local dataset as you would want to in these situations.
It's such a useful tool to us know that we install it with nearly every Joomla! deployment that we do.
What it does do |
What it does not do |
|
|
This is where most of the confusion is, by what I read in my email from people asking me how to use it! This is a code solution to using external databases. There is no way of using this without modifying some code. That out of the way, here's how to use it in that code.
ExternalDB simply creates a new jDatabase object with your given connection details - nothing clever but simple to maintain connection details. Here's a sample of code from one of our components...
// Create new ExternalDB instance, using the details that we set earlier.
// 'resultsDb' is what we called the DSN
$dbxo = new externaldatabase ( 'resultsDb' );
// Create a new jDatabase object, connected with the details from the above selected DSN.
// We call ExternalDB objects $dbx just as a standard practice
$dbx = $dbxo->getDB ();
$sql = "SELECT * FROM sport WHERE site = 2"; // Some simple SQL..
// Now you use your ExternalDB object in exactly the same way as you would the regular DB object..
$dbx->setQuery ( $sql );
$dbx->query ();
$res = $dbx->loadAssocList ();
I hope this clears up things! We'll be working on moving this over to 1.6 very soon.
![]()
Chris Williams
chris@imnotplayinganymore.com
PHP & Joomla! Developer

West Midlands Joomla! User Group is now up and running.