Category Archives: General


How to get number of cart items in Magento

Many websites show a “total number of items in your basket”. So, how do you get that information out of Magento if you’re not in the checkout process? You can simply call the Mage Helper file checkout/cart. If all you’re …

Where has apache2-ssl-certificate gone?

I was setting up SSL on our local Debian box at work, and needed to generate a new cert. apache2-ssl-certificate failed to work though, so what have they done with it? Well, they’ve moved it. If you’re setting up SSL …

jQuery UI Tabs and the Stylish Select Plugin

I was having issues with a site recently whereby the jQuery UI Tabs that were on the site weren’t working in IE. After chopping out all other includes and HTML/CSS that wasn’t needed for the tabs to display, I narrowed …

Law and the internet

There are a few things I enjoy other than web development. I love SEO, and Law also; having never found enough time to tackle either, I like to keep my eye in whenever something crops up. Something that SEO and …

Shell script to create new site template

Having a dedicated Linux box without any form of control panel on it is becoming the norm for me. To help me out, I created a small shell script to create the necessary files in the right places. It takes …

Delay link event with AJAX jQuery

I’ve been working on a script recently where it would add warnings when a user clicked on certain URLs. I attached an event to a link like so (simplified): 1 2 3 4 5 $(‘a’).each(function(){ $(this).click(function(event){ addWarningToURL($(this).attr(‘href’)); }); }); I …

How to check whether an element exists using jQuery

There are some subtleties to jQuery that still confuse me, compared to how traditional JavaScript acts at least. With traditional JavaScript, you could check for “an element”. The simplest example would be getting an element by ID. Say for example, …

Opening links in a new window with jQuery

With the advent of XHTML Strict 1, you can no longer use target=”_blank” on an A tag in your code. The only solution for this is to use Javascript to action a new window / tab to be opened. The …

Using shortcodes in a template file in WordPress

I’m using Contact Form 7 on a website I’m building. Currently, Contact Form 7 uses shortcodes, meaning you can drop forms into posts. Something like   You can’t use shortcodes in template files, because WordPress doesn’t parse them the same …

Replacing multiple occurrences of a string in JS

I’m a little disappointed JQuery doesn’t have something uber fancy for this. Something that always catches me out is when trying to replace occurrences of a string, it only replaces the first if you use the default “.replace” method. str …