Dr Martens For Life Microsite 15-03-2009

Haven’t updated the blog for a while so I thought I would create a few posts on what I have been up to in the early stages of 2009!

Back in February, I developed a microsite for Dr Martens, named ‘Dr Martens For Life’. The whole idea behind the site is to activate your guarantee for your Dr Martens Boots / Shoes for life!

Dr Martens For Life Microsite

Using CakePHP, I did some lovely custom validation to check if a guarantee code was valid (from a list of codes in a MySQL table) and also to see if it had not been redeemed before (only one code per product).

Take a look, if you fancy buying a pair of Dr Martens - take a look here too.

shhh.tv 23-12-2008

Looking for a special gift for someone but cannot think of what?

Well shhh.tv is here to sort that!! simply, answer a few questions and generate a gift for a friend or foe… its a shhhhhecret!

shhh.tv screenshot

shhh.tv is a MAKE project for LOVE.

I am proud to say that I built the ‘back-end’ of the site…. ooooh err, using the CakePHP framework, MySQL and AMFPHP.

Enjoy and Merry Christmas!

Green Santa 12-12-2008

Green Santa: Your Santa Needs YOU

Been really busy at LOVE for the last couple of weeks (well all year to be honest!), working on numerous websites including the lovely Green Santa website.

Taken from the LOVE blog post: “The basic premise of Green Santa is simple:
Global warming is causing Santa’s runway to melt.
If Santa’s runway melts, his sleigh can’t take off.
If his sleigh can’t take off, he can’t deliver your Christmas presents.
So if you want your presents this year, you’ll need to do your bit for the environment first.”

There is also a Green Santa Facebook Application, if your a facebook user - please add the application to receive the lastest breaking news to your profile!

Visit Green Santa and make a pledge!

Fresh Digital Awards 2008 : Results 21-11-2008

LOVE Fresh Award WInner 2008

Last night LOVE were nominated for the “Freshest Digital Campaign” for the work carried out on Warburtons We Love Bread website.

I am glad to say we won! Well done to all those involved, including: Adam, Jim and Stu.

HOWTO: MySQL - Update Data in one table from another table 18-11-2008

I have just been refactoring a legacy database and needed to update some data in one table from another table in MySQL.

In this case the 2 tables had the same values for the identity colomn.

Syntax:

UPDATE tablename1 t1
SET colomn1 = (SELECT colomn1 from tablename2 t2 WHERE t1.id = t2.id);

For example

If i had tables: ‘products’ and ‘merchandise’ and needed to copy the product title into the merchandise title colomn, I would simply:

UPDATE merchandise m
SET title = (SELECT title from products p where m.id = p.id);

HOWTO: MySQL - Insert Data from one table to another table 18-11-2008

I have just been refactoring a legacy database and needed to copy some data from one table into a new table in MySQL.

Very easy task but very easily forgotten, just thought I would blog about it to help anyone searching for a quick answer…

Syntax:

INSERT INTO tablename (colomn1, colomn2 ...)
SELECT colomn1, colomn2 ...
FROM tablename;

For example

If i had a products table and needed to copy the product title into another table named ‘merchandise’ I would simply:

INSERT INTO merchandise (title)
SELECT title FROM products;

Fresh Digital Awards 2008 18-11-2008

Fresh Digital Awards Image

On Thursday night LOVE will be attending the Fresh Digital Awards 2008, unfortunately I won’t be there due to other commitments. We are nominated for 1 award - ‘Freshest Digital Campaign‘ for the work I was involved with for Warburtons ‘National Bread Week‘.

Here’s hoping that we scoop another award for this lovely website!

HOWTO: Reset your MySQL Table Auto Increment Value 12-11-2008

Something I seem to do quite regularly at the moment is resetting the auto increment value for a table in a MySQL database.

Really easy to do but also very easy to forget the syntax:

ALTER TABLE tablename AUTO_INCREMENT = value;

For example
If I had a products table and I created a few new products and then deleted them, to set the auto increment value back to ‘53′ i would simply:

ALTER TABLE products AUTO_INCREMENT = 53;

Custom Validation Rules in CakePHP 1.2 06-11-2008

CakePHP’s validation class is pretty powerful, however there may be a time when you require a validation method that hasn’t been defined, this is where custom validation rules fit in.

Lets imagine you have a select box containing a users ‘title’ field in a form. You also have a ‘other_title’ text field which must be filled in if the ‘Other’ value is selected.

How would you go about validating this?

Simple: In your Model specify your validation criteria as so…

var $validate = array(
'title' => array(
'rule' => array('minLength',1),
'message' => 'Please select your title'
),
'other_title' => array(
'rule' => array('_compareFields', 'title', 'other'),
'message' => 'Please enter your other title'
)
);

As you can see when the Model validates, the ‘other_title’ field is validated against a custom rule named ‘_compareFields’ parsing in ‘title’ and ‘other’ as parameters.

‘title’ is the field to compare ‘title_other’ with and ‘other’ is the compare value that I am matching on.
Therefore the custom rule looks like:

function _compareFields($field=array(), $compare_field, $compare_value){
if(!empty($this->data[$this->name][$compare_field])&&(strtolower($this->data[$this->name][$compare_field]) == strtolower($compare_value))) {
$field_value = array_shift($field);
if(!empty($field_value)) {
return true;
} else {
return false;
}
} else {
return true;
}
}

I could of simply used ‘Other’ as the $compare_value but I like writing generic functions that can be re-used multiple times. This function will now cater for other fields with different $compare_fields and the ‘case’ of this value is not sensitive in the view.

Hope that helps someone out there!

Rome Rome Rome… 25-10-2008

Pantheon

Just returned from a nice 4 night stay in Rome with the missus. Rome is absolutely amazing! Saw all the sites, drank the beer, gawped at the cars, mixed in with the beautiful locals and saw some monkeys having rampant sex in the zoo… hmm

One of my favourite highlights of the trip was the Vatican City. The detailing on the dome was too much to take!

dome

We managed to view not only the Vatican City, but also The Pantheon, Roman Forum, Villa Borghese, The Colosseum, Spanish Steps, Piazza Navona, Trevi Fountain, Capuchin Crypt and the Catacombs. So much to see in so little time….

Here are some snaps…

The Colosseum
The Colosseum exterior

The Colosseum interior

The Colosseum exterior

Roman Forum
Roman Forum

Villa Borghese
Villa Borghese

fiat-500

cheeky monkeys

Mark Holt

This is the blog of Mark Holt, a Manchester based web developer currently working for LOVE.


Search

Categories


Work/Clients