Functional test helpers for symfony 1.4 code

We you come to write functional tests in symfony 1.4 you can end up with a lot of duplicated code when testing basic things like the routing. To make life easier you can add helper functions to your tests to reduce the amount of duplication, and speed up test writing. So let’s start with the routing example.
Continue reading Functional test helpers for symfony 1.4 code

Symfony2: Beta1 available!

It’s here, Symfony 2.0 Beta1 is now available to download and play with. You can Download Symfony 2.0 Standard Edition beta1, a good place to start is the quick tour, or the book, both of which should give you a good push in the right direction on how this new version of Symfony fits together. Continue reading Symfony2: Beta1 available!

Michael Owen Online relaunch

Michael Owen OnlineThe DNS has migrated and the new code is online. The new version of Michael Owen Online has gone up with almost no problems. The only issues that were seen were 2 HTML files Google Webmaster tools looks for to prove you own the website, and a collection of wordpress URLs which were not identified and 301’d when the new code went up. As re-launch issues go they were pretty minor. Continue reading Michael Owen Online relaunch

How to add facebook like to an InVision forums template

Adding facebook like to an InVision forums template turned out to be very easy, but it did take me over an hour to work out how. As a result I thought it best to share this code sample to save others hours of google’ing for the answer or banging their head against the table for as long as I did.

Initially I thought it would be as easy to add a short block of PHP to a template file so I tried to use:

<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) ?>&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>

Continue reading How to add facebook like to an InVision forums template

Easy ways to create a 301 redirect in code

Since my post the other day on A simple way to correct the hostname for your website I’ve been thinking about ways to do the same in other languages so I thought I should share my findings with you. I’ll only cover the most common web languages and methods, but if you think I’ve missed any out then add them in the comment section below for the benefit of others.
Continue reading Easy ways to create a 301 redirect in code

A simple way to correct the hostname for your website

There are several ways to force the correct hostname on a website. Normally this is done with mod_rewrite within the vhost or within the .htaccess file (if allowed). However there is a very simple way to do it with PHP. All you need to do is check that the value of $_SERVER[‘HTTP_HOST’] matches the domain name you want your site to work under.

Continue reading A simple way to correct the hostname for your website

Free offsite backup via Google

Offsite backup is one of those luxuries that most small websites and bloggers will never have, mainly because of cost, but sometimes because our hosting solutions do not support or offer them.

So this week I lost the server that my sites sit on for a few days, and I realised that I have no real backup of the databases on there. I have a copy of the code as it’s within SubVersion, so there was never really any chance of losing that part of my site, but what about my database. This got me thinking, is there a way I can sort out a form of offsite database backup?
Continue reading Free offsite backup via Google