Accessing Google Docs Spreadsheets in Firefox 4 Beta

Posted October 9th, 2010 (Updated 29 Oct 2011) in Uncategorized

I installed firefox-4.0 (currently 4.0b8pre) on Ubuntu Maverick RC earlier today and all was going fine and dandy until I had to open a Google Docs spreadsheet. I’d receive a message stating:

The <strong>bad news</strong> is that Google Docs has just encountered an error.
The <strong>good news</strong> is that you've helped us find a bug, which we are now looking into.
We apologize for any inconvenience this has caused you.
In the meantime, if you'd like updates on this and other issues, try visiting the Google Docs Help Forum.
<strong>Sorry, and thanks for your help!</strong>
- The Google Docs Team

I checked documents and they seemed to be fine. It turns out this is an issue with Google not recognising FF4′s user agent string. The easiest way to solve this issue is to type about:config into the address bar and set


to true.

Read More »

“Discovery Failed” with Zend OpenID

Posted October 2nd, 2010 (Updated 29 Oct 2011) in PHP

A very quick post for any of you poor souls suffering the dreaded ‘Discovery Failed’ message in Zend_OpenID_Consumer when trying to connect to Google – see this comment on Stack Overflow for the solution you’re looking for. Hopefully this’ll save you some time hunting around on the web for it.

Read More »

Resized Image URLs with Kohana 3

Posted August 31st, 2010 (Updated 29 Oct 2011) in PHP

Have you ever wanted to generate a resized version of an image just using a HTML image tag and not worrying about entering large chunks of resizing code or storing cached images of various sizes? Today’s tutorial will show you exactly how to do that with Kohana 3. In this tutorial I will teach how to use the URL to load a dynamically generated, resized image.

The trickiest concept to grasp in this tutorial are the URL segments. Imagine your site was located at and you were browsing to this page In this instance, ‘segment 1′ would be archive, segment 2 posts and segment 3 my-post. Segments are split with the / character. In Kohana, URL segments take the following form: controller/method/method_arg_1/method_arg_2/etc…

Read More »

PHPExcel Module for Kohana 3

Posted July 31st, 2010 (Updated 29 Oct 2011) in PHP

As with any project involving generation of .xlsx spreadsheets there’s only really one way to go – PHPExcel. This amazing piece of software boasts a large feature set – allowing quick and (relative) painless generation of XLS, XLSX, PDF, and CSV to name a few as well as importing of the same sans PDF. I recently had to integrate PHPExcel into Kohana 3 so I figured I’d take the time to post the how-to and hopefully make your lives that little bit easier. In addition I’ve included a quick and dirty Spreadsheet class to make XLSX generation that bit faster.

Read More »

Integrating Swift Mailer Into Kohana 3

Posted June 29th, 2010 (Updated 29 Oct 2011) in PHP

This is quite possibly one of the simplest integrations in Doctrine history (It’s a 1 liner, folks). The following is a short tutorial on how to create a SwiftMailer module for Kohana 3

Create the following files/folders:

Inside /modules/swiftmailer/classes/ drop the official latest build of Swift Mailer.

Enter the following into init.php.

	require Kohana::find_file('classes', 'Swift-4.0.6/lib/swift_required');

There. Wasn’t that easy? Remember to enable the module by adding it to your bootstrap.php file!

Read More »

Kohana 3 Multiple Scripts and Styles Extension

Posted June 27th, 2010 (Updated 29 Oct 2011) in PHP

In Kohana 2, html::script() and html::stylesheet() accepted an array or string as their first arguments. This allowed you to easily add multiple scripts and styles simultaneously without needing to write several lines of redundant code. Kohana 3 has removed this useful ability so I thought I’d write a very quick extension to add the feature back in. The following script adds HTML::scripts() and HTML::styles() (As Kohana 3 slightly renamed their functions to HTML::script() and HTML::style() respectively).

Simply add the following file html.php to your /classes directory:

<?php defined('SYSPATH') or die('No direct script access.');
class HTML extends Kohana_HTML {
	public static function scripts(array $scripts, $attributes=array(), $index = FALSE)
		$response = '';
		//Data sanitisation
		$index = $index ? TRUE : false;
		if ( !is_array($attributes) ) $attributes = array();
		foreach ( $scripts as $script )
			$response .= html::script($script, $attributes, $index);
		return $response;
	public static function styles(array $styles, $attributes=array(), $index = FALSE)
		$response = '';
		//Data sanitisation
		$index = $index ? TRUE : false;
		if ( !is_array($attributes) ) $attributes = array();
		foreach ( $styles as $style )
			$response .= html::style($style, $attributes, $index);
		return $response;

Download: html.php


echo HTML::styles(array(
echo HTML::scripts(array(

Note: Both functions accept the latter 2 parameters available in Kohana 3 HTML::scripts() and HTML::styles(). If used, these arguments will be applied to every element in the first arguments array.

Read More »

Doctrine Driver for Kohana Auth Module [Updated 21 Feb 2011]

Posted June 21st, 2010 (Updated 29 Oct 2011) in Database, PHP

It’s probably become apparent by now that I like Doctrine. It’s quick, it’s easy and it works with everything. So here’s a Doctrine driver for the Kohana Auth module, allowing you to use Doctrine instead of Kohanas integrated ORM.

Download: Kohana Auth Doctrine Driver 1.03 here

Installation instructions:
Unzip the module to your /modules folder.
Enable the module by adding

'auth_doctrine' => MODPATH.'auth_doctrine',  // Doctrine driver for Auth module

to the modules array in the following file:
Kohana 3:/bootstrap.php
Kohana 2: /config/config.php

UPDATE Jul 15 2010: Fixed incorrect user login bug. Please redownload
UPDATE Dec 22 2010: Fixed ‘remember’ session bug.
UPDATE Jan 3 2011: Fixed bug if calling Auth::instance()->logged_in(‘role_name’). Thanks to freenode #doctrine user SirFunk for this one – good catch!
Update Feb 21 2011: New module at a new home! See here for details

Read More »

Integrating Doctrine Into Kohana 3 [Updated 21 Feb 2011]

Posted June 21st, 2010 (Updated 7 May 2011) in Database, PHP

Update Feb 21 2011: New module at a new home! See here for details

Upon the release of Kohana 3, one of the first things I wanted to do was install Doctrine. The following is a short tutorial on how to do; and keeping with Kohanas modular style, it will be placed in its own reusable module. Time to begin.

Create the following files/folder:

Inside /modules/doctrine/classes/doctrine drop the official latest build (see here) of Doctrine such that Doctrines CHANGELOG, COPYRIGHT etc files etc are inside.

Enter the following into init.php. Note – this may not be the optimal bootstrap file – feel free to tweak to your hearts content.

Read More »

HTML5 Link Prefetching

Posted June 3rd, 2010 (Updated 29 Oct 2011) in Uncategorized

Here’s another little gem for you HTML5 fans out there – link prefetching. Adding the following into a HTML meta or link tag will result in the target being loaded in the background after your current page.

<link rel="prefetch" href="/images/big.jpeg">
<link rel="next" href="2.html">
<meta http-equiv="Link" content="/images/big.jpeg" rel=prefetch">

Both ‘prefetch’ and ‘next’ are accepted.

Here are a few advantages of using this method:

  • It’s HTML compliant
  • It’ll dramatically speed up the resulting page/file if successfully prefetched
  • It doesn’t slow current page load
  • No same-origin restriction – any domain is accepted

There are several limitations to this method that should be noted:

  • Firefox only (for now)
  • Only HTTP protocol is accepted
  • No URLs with querystrings accepted

To learn more about link prefetching check out the Link Prefetching FAQ at Mozilla Developer Center

Read More »

Converting the Default URL Separator to Dashes in Lemonstand

Posted June 1st, 2010 (Updated 3 Sep 2012) in Database, Lemonstand, PHP

When it comes to online shopping carts, LemonStand is the hot new thing. Still in beta, this piece of software boasts a surprisingly large feature set and high level of customization options usually only seen in much larger CMS’s. The one narking issue I’ve had with it so far is its choice of URL separator – preferring underscores over dashes. After speaking to the very polite and friendly developer behind LemonStand, a solution was quickly devised.

To convert the default URL separator in LemonStand from underscores to dashes simply add the following line of code to your config/config.php file.


Update 3 Jun 2010: I’ve received word from the author behind LemonStand that he’ll be publishing an update later today changing the default URL separator from underscores to dashes. The change will not affect any existing installations and only apply to new installations. For developers wishing to change the default separator on new pages on existing installations, the fix above still applies. This is great news that I’m sure many developers out there will be pleased with.

Read More »

Page 11 of 13« First...910111213