Vote for the Best Swedish API


A week after launching the Swedish API directory it has already grown by 10%, from 200 to 220 Swedish APIs. We are very happy with this and with the great feedback we have received.

To further help focus the attention on local Swedish APIs we are now starting a competition to find out which is the best Swedish API. After about 2 weeks of voting we hope to present the best API the country has to offer!

Introducing the Swedish API directory


We at Dopter have just released the Swedish API directory. It is a directory with over 200 Swedish APIs organised and easily searchable.

We have noticed a real need for this during the last few years when we have been working with our customers and their APIs. There have been a real lack of a one-stop-shop to let developers find Swedish APIs and it has been hard for Swedish API providers to reach developers. Now we hope to have solved that problem…

Two CodeIgniter libraries I can not live without


I have said it before and I say it again – “Hi, my name is Andreas and I am a CodeIgniter junkie”. I can quit my CodeIgniter (a PHP framework) habit whenever I want, but why would I want to (read Why I fell for CodeIgniter to know more)?

For the last few CodeIgniter projects (begagnadebarnklä – hitta billiga barnkläder for example) I have used two libraries that have made my life as a developer much easier and that I really recommend anyone using CodeIgniter take a serious look at. Those libraries are IgnitedRecord and BackendPro. They are not brand new, but they sure get the work done!

IgnitedRecord is a ORM library that makes interacting with the database so much easier. Especially handling relationships between tables much easier to deal with, an example is getting all posts a user has written in a blog:

$posts = $user->related('posts')->order_by('name', 'desc')->get();

Nice and clean and very easy to setup, all you need to do is to have your models extend IgnitedRecord and then define the relationships in the model. Some other goodies are that it is very easy to make subqueries and nested WHERE statements.

Instead of going in to all the details here I think you should go and download IgnitedRecord straight away and get started, it will save you time.

Almost every project needs some kind of administration backend. With some frameworks (Django) you get this out of the box, not so with CodeIgniter unfourtunatly. BackendPro gives you that and so much more – it also helps out with things like user authentication and access rights, asset management, breadcrumbs, preference handling etc. Only the fact that it is an easy to setup and then handles basic user authentication (such as login, registration and forgotten password) is well worth the price of admission (which is nothing since it is all free). BackendPro also comes with the excellent Matchbox library, which lets you organize your code into modules.

Combining the two
Unfourtunatly the two do not fit perfectly together since BackendPro uses CodeIgniters standard database libraries, so if you need to do any database work with BackendPro itself you need to remember not to use IgnitedRecord. Getting the two libs to play nicely once they are installed is quite straight forward though…

  • Move the ORM() function from system/application/libraries/MY_Loader (a IgnitedRecord file) to system/application/libraries/Loader (a BackendPro file).
  • Delete the MY_Loader file
  • Optionally you could autoload the IgnitedRecord library
  • To make it all work I had to make a file called ignitedrecord.php in system/application/libraries that includes ignitedrecord/ignitedrecord, as per

Do you have any other favorite libraries for CodeIgniter? Please let me and everybody else know in the comments!

Manage many WordPress blogs with one installation


If you are anything like me you have way to many sites to run and maintain, and quite a few of them are probably running on WordPress. The last few versions of WordPress have done wonders when it comes to making it easy to update when a security updates comes out, you just click a button and the rest is taken care of. But if you have many sites and many plugins that also needs updating this can become a full time job, and a very boring full time job at that.

WordPress MU – a bit too limiting
One solution to this is to use WordPress MU which allows you to run many blogs in the same installation. The problem with WordPress MU is that it is quite a hassle to install, and it requires the kind of server access that you won’t have if you run on a standard shared hosting account. Another problem with WordPress MU is that it is usually a few versions behind the regular WordPress, so the latest and greatest (and most secure) features and plugins won’t always work. The WordPress people have stated that moving forward WordPress MU will be one of their areas of focus, so I expect that all the negative stuff I just mentioned will be gone in a year or two, but I want a solution now!

WP-Hive to the rescue
Lately I have started to use the WordPress plugin WP-Hive to solve my multimple WordPressblog problem, and so far it has worked very nicely. Install WordPress and the plugin according to the plugins documentation, it requires some copying of files but otherwise it is pretty much like the standard WordPress install. After you have one blog setup with WP-Hive you can add more blogs to the same WordPress installation, each blog with it’s own domain name and it’s own unique settings. The great thing is that all the blogs you install will share the same basic WordPress installation, the same plugins and the same themes. So you only need to update WordPress or a plugin once and it is updated for all blogs, that is a real time saver. Since WP-Hive is a WordPress plugin you can also use the latest and greatest WordPress verison and all the other plugins that you want.

At the moment I am running some Swedish wedding sites this way, for example Bröllopsinbjudningar, Bröllopsmeny and Bröllopsbukett. They all use the same plugins and the same theme, but all have different settings and different content. With some help from WP Super Cache all my blogs are running nicely from a shared hosting account. The only negative thing I have noticed is that if you have several domains starting with the same letters (“br” in my case) you need to do some manual setup in the database to get things to work.

Do you use something else than WordPress MU or WP-Hive? Tell us all about it!

Click Tracking with jQuery


Generally I use only Google Analytics for the stats of my web apps, but for one of my current projects (Bröllopia – sökmotorn för ditt bröllop – a swedish wedding site) I needed a bit more. I wanted to have detailed statistics for links leading to other sites to use these stats in the app itself. One way of doing this is of course to make all these links go to a page on my site and then when this page loads I record all the stats I want and then redirects to the external site, for example the link loads tracker.php and logs a click on the link with the id “123” (this id needs to be mapped to a link in the database) and then forwards to The link on my site would then look like this:

<a href=''>WebHostNinja</a>

The problems with this is that it is slow (one more page load) and that the link the user sees does not lead to the page, ie the link text “WebHostNinja” and then the user expects the link to be something like “” and nothing else. I don’t like this from a usability point of view. Not that I have any evidence for it, but I suspect that relevant outgoing links help the sites Google juice. Definitly it helps the Page Rank of the site I link to, and why should I not help them?

My solution is to use some jQuery magic. Download and install jQuery (btw, if you like jQuery, then take a look at the fantastic jQuery tools). Then add the class “track_this_link” to each link tag that you want to track as well as give each link tag an unique id (so you can track which link is which). The href attribute should point to the external site directly and not to some internal page. The link above would now look like this:

<a href='' id='123' class='track_this_link'>WebHostNinja</a>

Next step is to add a some javascript that adds an onClick event to all the links with the class “external_link”:

$('a.track_this_link').click(function() {
$.post(, {});
return true;

This means that each time an external link is clicked a post request is sent to with a unique id for the link in question. What is left is to implement the tracker.php script so that it can handle the post and save the data you are interested in to the database in a secure and correct way. I am happy to just summarize the number of clicks per link on a daily basis, but if you want to save detailed data for each click.

Do you have a better solution to this problem? Let me know!