Skip to content


Smarty PHP Google Maps API plugin

When I wrote my last post on PHP Smarty I was still wet behind the ears when it came to web development, but 3 years on and I have got a bit more experience and can offer a bit more insight to my fellow web ninjas out there…wachaaa, judo chop!!

I was recently building a web application where I was using Smarty, which is a really lightweight templating engine and I would definitely recommend using it instead of Flexy (part of PEAR) as the documentation is almost ten times as good and it doesn’t rely on a massive PHP library like PEAR.

The Google Map API plugin for Smarty has been around for a few years now and the latest release is version 2.5 which was released in September 2007.

It is really easy to use and if you are familiar with the way Smarty works, then you’ll be laughing!! There is some detailed documentation on phpinsider.com, so if you need any help then I would suggest this page.

All you need to get going is the following:

  1. Latest version of Smarty(obviously)
  2. The Google Map API class plugin
  3. A Google Map API key

It is really configurable and is very easy to integrate into existing Smarty templates, so why not give it a try…here is a demo.

Tags: , .

Swanage triathlon 2009 race report

In an effort to keep my readers (I know there are millions of you out there :)) updated I thought that I would try to write a few reports on recent races that I have done…so here goes.

On Sunday 9 August 2009 I took part in the Swanage Olympic triathlon in Swange(obviously) which is close to Poole/Bournemouth.

I travelled to Swanage on the Friday evening and stayed at the Herston camping site, which was not the best camp site I’ve ever stayed in and was incredibly overpriced. I paid £20 a night for a 2 man tent and the ablutions blocks were abysmal to say the least. Also, the other campers were pretty bleak when our crew of about 20 people work up on Sunday morning at 05:00 to get ready for the race, but I suppose that was to be expected anyway.

Registration took place on the Saturday and was very conveniently located close to the main promenade and beach, and offered exactly what an athlete wants before race day…a hassle free registration. There was a store at the registration tent offering a few bargains, but nothing out of the ordinary.

I really enjoyed the race on Sunday and ended up switching waves so that I could race against two of my training partners, which made for some exciting moments in the final few metres of the run where I was involved in a sprint finish that I lost 🙁

The swim was fantastic, except for the middle section where we had to clamber up some slippery steps and run down a slipway before heading back towards the main beach. The water temperature was ideal and being a relatively small race I didn’t feel like every other triathlete in the race was on top of me.

After the swim there was quite a challenging run along the promenade and up a few steps to the transition. Then it was on onto the bike which was also really enjoyable, although it would have been better if they roads were closed. If the event gets bigger it would be great if the organisers could request some police marshalling from the council. The bike leg offered one challenging decent with 3 s bends, one or two climbs requiring some effort and lots of rolling hills where one was able to keep the one’s speed pretty constant. Also, there was quite a lot of beautiful scenery to look at during the 40km route.

Sprint finish

Then it was into transition again and onto the run, which was a BEASTY to say the least. There was 400ft of climbing in the first few km’s and I have to admit that I did walk at one stage when I was running up the first big hill. Once the hill had been conquered one was rewarded with a fantastic view across the bay and of the country side, which did make it worth it :). Then there was a steep decent and a loop in the country side before heading back to town for the finish.

Swanage is a lovely little town and I hope that the triathlon gets more popular as it was a really enjoyable although the organisers could the following improvements:

  • To realize that I changed numbers and waves and am not still waiting to start 🙂
  • Road closures for the bike course
  • Finishers medals
  • A proper timing system with timing chips

Here is a link to the event

Thanks to Megan for taking such cool photos…I hope you don’t mind that I’ve used them on my blog 🙂

Tags: , , .

Being a triathlete is tough

Thanks to Matt for sending this to me…I really enjoyed it:

A man was out jogging in the forest one day when a frog called out to him and said “if you kiss me I will turn into a beautiful princess” he bent down and picked the frog up and put it is his pocket.

The frog spoke up again and said “if you kiss me and turn me back into a beautify princess I will tell everyone how smart and brave you are and hoe you are my hero” The man took the frog out of his pocket smiled and return the frog to his pocket.

The frog spoke up again and said “if you kiss me and turn me back into a beautiful princess, I’ll stay with you for a year and do anything you want” Again the man took the frog out of his pocket, smiled at it and put it back in his pocket.

Finally the frog asked, “whats the matter? I’ve told you I’m a beautify princess and that ill stay with your for a year and do anything you want. Why wont you kiss me?”

The man replied, “look I’m a triathlete. I don’t have time for a girlfriend, but a talking frog is cool.”

Tags: , , .

Go away IE6, you’re not wanted here :)

Thanks for sending me this link Drew, you made Friday afternoon in the office a little more bearable:

Just in case you don’t know…I despise IE6

ie6

Custom error pages on Internet Explorer

Being a web developer I am often faced with the challenge of getting a website looking sweet in various types of browsers and versions of those browsers.

Firefox

Each browser interprets code differently, so when one writes code which renders correctly in one browser it doesn’t necessarily render as well in another browser. The thorn in all web developer’s sides is good old Internet Explorer 6 or IE6. One can build a webpage which looks fantastic in the world’s best browser Firefox (yes I am biased 🙂 ) and then look at it in IE6 and it will most probably have layout issues.

There are numerous tricks and hacks to get web-pages looking good in IE6, so one just learns to deal with how bad the browser is.

So, what’s the real issue?

Just to re-enforce how bad the browser actually is, I was recently told about how Internet Explorer (all versions) have a built in default error page which will always be displayed even if you have added a customized error page to your web project.

What it boils down to is that if your custom error page is less than 512 bytes, it will never be rendered in IE. I seriously could not believe it when I saw the article by Jeff Starr, but it’s true. So, some Microsoft employee specifically wrote code to do this…one has to ask why? I mean seriously, what was the logic behind this decision? What a bunch of jokers!!!

To make matters worse, there even settings for this in the Windoze registry which differ according to the type of error….craziness!!

\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\ErrorThresholds
Error - threshold (default)
400 - 512 bytes
403 - 256 bytes
404 - 512 bytes
405 - 256 bytes
406 - 512 bytes
408 - 512 bytes
409 - 512 bytes
410 - 256 bytes
500 - 512 bytes
501 - 512 bytes
505 - 512 bytes

Useless tip of the day: Ensure that your custom error pages have enough useless content in them to make them larger than 512 bytes

Tags: , , .

Ensuring the hand cursor is displayed in Flex components

I’m not sure if it’s a bug in the Flex code framework, but I have found it difficult to get the handcursor working when hovering over components like Labels/Text which arn’t used as links by default. After bashing my head against my desk for a few hours and doing some research on the web, I finally came across a soution which which works in most cases. To get the hand cursor working you need use the following 3 properties:

buttonMode=”true” mouseChildren=”false” useHandCursor=”true”

Here’s an example of a Label which is used as a link:

< mx:Label text="Log out" buttonMode="true" mouseChildren="false" useHandCursor="true" click="logout()" />

It seems like it’s a pretty common problem and these two articles showed me the light of day, thanks dudes!

Tags: , .

G3 Global launches a new website and blog

I am currently working for G3 Global a company specialising in SAP implementation in the media industry. Apart from building web portal applications for clients, I have also been working on improving the website.

G3 Global is a SAP Channel Partner specialising in the implementation of SAP ERP solutions in the Media industry.

The old site was built using static php pages, had a dated design and was disjointed in a few areas. So, we set out to improve the site by putting more emphasis on our products, the introduction of a fresh design, a flatter hierarchy, a blog, and an events section.

The design was done by “Andy, the chief coffee drinker” at Caffeinehit Ltd . I have to say that he did a great job after lots of Starbucks Grande latte’s and a few design workshops in our offices.

I did the implementation of the site and for those of you that care…yes the geeks ;), I used wordpress as the CMS solution along with a number of plugins which I either downloaded and hacked or wrote myself.

Overall I really enjoyed working on the site and I think it has been well received by the rest of the company. Now all we need to do is get everyone blogging…so I’m going to have to answer questions like – “what’s a blog?”, “how do i put a list into a post?”…blah, blah, blah 🙂

Besides Andy, thanks also go out to Chris and Drew for their hard work and guidance. Good effort lads!

Tags: , , , .

Don’t let the distance scare you

While browsing some runners blogs and websites I came across these paragraph by Karl King – not sure who he is, but I think it’s classic:

When my longest run was 13 miles, a marathon seemed nearly impossible.
When my longest run was 26 miles, 50 miles seemed nearly impossible.
When my longest run was 50 miles, 100 miles seemed nearly impossible.
When my longest run was 100 miles, 50 miles seemed like a nice, long training run.

Don’t let the distance scare you; run from aid station to aid station and the distance will take care of itself.

Tags: , .