After 2009 rolled in and all our sites failed to follow suite because “someone” hard-coded the years – but only up to 2008 – I quickly had to write something a bit more – well, smart.

I needed an HTML drop-down box with a set of years starting from a fixed year, but extending to the current year so that it would always be up-to-date and I wouldn’t have to run around updating reams of HTML each year.

I have assigned the year from which to start from as $INCEPTION_DATE. To get the current year, which will be the top of the range (we don’t need future dates), you simply use the PHP date function like so: date('Y'). The simply iterate through the years. I have also set the drop-down box so that the current year will be selected by default.

I lost all my content when the blog got hacked and my hosting company could not restore it. I have subsequently unearthed a heap of old posts (that had sync’d to Facebook as Notes). It’s really interesting (and quite funny) to see what I was busy with so many years ago!

As more and more sites strive for standards-compliant code that passes validation, the developer now faces a conundrum: the once simple process of adding the _target attribute for links opening in a new browser window or tab will not validate.

You do NOT want a visitor to click away from your site. It took all kinds of wizardry (or hard cash!) to get the user to your site, and now you want to keep him / her there.
The traditional method was to use the target attribute of the tag, for example:

<a href="www.anotherdomain.com/page.htm" target=”_blank”>Click me</a>

This, however, will not validate as HTML 4.01 Strict orXHTML 1.0 Strict, as the _target attribute is deprecated in both. If, like me, you have opted to start coding standards compliant code, this presents a new challenge: how do I stop my visitors from “clicking away” from my site?

Let’s differentiate between links here:

Links that form part of your sites navigation

Links to resources within your site (images, PDF’s, etc)

Links that lead to external pages or resources

In the case of links in the first class, as you are surely not using frames (!!), there is no real need for these pages to open in a new window or tab – in fact, quite the opposite. As such, they should visually form part of a navigation structure (navigation bar, breadcrumb navigation), thereby implicitly indicating that the link is to another part of the same site. I think users are used to this idea.

In the instance of links that fall into the second & third classes, there needs to be some indication as to what the link is. If it is to a PDF for instance, put an icon next to the link – . Links such as these generally do not form part of the formal navigation structure, and are therefore visually different from such links (you could use some CSS here to style your links).

You do of course have the option of using unobtrusive JavaScript to open the link in a new page.

I have heard of users setting their browser to open ALL links in a new tab when clicked!

The solution I believe boils down once again to educating the user to either right-clicking on links that do not form part of the site’s navigation, and selecting Open in New Tab, or center-clicking / clicking with the scroll-button on the mouse (if they have one).

I got stuck writing a query for Firebird today. And here I was thinking that SQL was a standard — if only the “S” were for “Standard”…

I was busy writing scripts at work to paginate results in our BI portals. In MySQL I would usually write something like this to return the first 20 records:

SELECT * FROM `table` LIMIT 1, 20;

Not so in Firebird:

SELECT FIRST 20 SKIP 0 * FROM `table`;

In the MySQL, the 1 denotes from which record to start, and the 20 how many records to return. In the Firebird syntax, the FIRST denotes the number of records to return, and the SKIP specifies from which record to start.

Naturally, to effect the pagination, you would use variables passed between the pages to control moving between sets of records.

The support for Firebird is nothing like that for MySQL — and it took me quite a while to find the answer. Sometimes the geeks disappoint…