Phil Sturgeon to talk FuelPHP at next PHPNE

I can not wait until Tuesday 18th October! It has just been announced that Phil Sturgeon will be giving an introduction to FuelPHP. Most of you will know that Phil is part of the development team of FuelPHP and has already given us Codeigniter, an amazing php framework which has changed my life in many ways.

I have been involved with web development for around 10 years now. Sounds surprising but it’s true. My life/job has involved many things as well as pure web development. I have been involved with core business projects such as setting up a business, accounting and marketing as well as project and client management. When it comes to web development, my day to day activities include working with HTML, XHTML, CSS, PHP, Photoshop, WordPress, Magento, MySQL along with server setup and management. I call myself a php web developer because that is what I do most and what I love most; however I am really  a jack of all trades.

For most of the projects I have worked on I have been either the sole developer or the senior developer. Everything that I know about PHP has been self taught, everything has been trial and error. I did go to Teesside University and studied Information Technology which touched on some web development; however in my opinion the University need to seriously sort itself out when it comes to our industry, its shocking… but thats a blog/rant for another day.

Throughout my life as a developer, I been involved with many different sized project and when you don’t have another developer to bounce ideas off you learn quickly. It is also very easy for you to slip into bad habits. When you are planning a project you have to assume that your doing things the best way. You don’t want to show a ‘weakness’ and ask other developers if you are doing something the right way! After sometime, I realized I was reusing my own code over and over again in new projects. Therefore,  I started to comprise a folder of all the functions, classes, html templates and css that I would usually have to write from scratch for each project. At the time I did not realise this was known in the industry as a ‘framework’. By the time I came across frameworks such as Codeigniter, Zend and Kohana, I was too involved in my own framework. I had also made contact with other PHP developers online who were dead against using frameworks… ‘frameworks go against what PHP is’… ‘frameworks will slow down your system’… ‘frameworks contain loads of pointless code’… ‘frameworks will slow your development down’… the list goes on and on… so I got a bit stuck! I knew my own framework inside out, it was quick, it worked… why use anything else? PHP is all about using core PHP… thats what its all about… right?

One sunny day a guy called Alex Akass encouraged me to start to use an open source frmaework. I should mention that I have never met Alex in person; however we speak nearly every day on Skype. I may be a sole developer but I do have a solid development team made up of contacts I have met online and more recently at such events as PHPNE. Alex introduced me to Codeigniter and I started to use it for a live project. I work in an agency where project turnover is high. I don’t have the luxury of time to look at new technology and work on something inhouse to test it before working on a live client project. I trusted Alex and I dived in. Since that day my life has changed in so many ways. To list a few:

  • More structured framework
  • Input from years and years of other developers experience
  • Access to functions and classes I would never have thought of
  • Much more reliable and stable final projects
  • Faster project development…. much faster!
  • A shed load of online blog and video tutorials
  • The feeling I am up-to-date
  • etc…

I could go on and on… however there is one thing that is missing from the list above which has rocked my world. When I started to use Codeigniter I started to see that things were not so different to the structure I had put in place for my own framework. Things I had created functions for were included in Codeigniter. It was an amazing feeling. The years I have been working on my own learning from trial and error were not wasted. I did know what I was doing! I feel as if I owe this feeling of validation to Alex and the creators of Codeigniter. Since making the jump to Codeigniter,  every day I have had on development has been even more enjoyable than before. If there is anyone out there waiting to make the jump, stop waiting… jump! You are not alone.

Recently I have been attending PHPNE events in Newcastle. I spend an hour traveling there and back on the train so that I can join the others in the pub after the talk to network. Its been a real eye opener for me. I really enjoy meeting and talking to other developers. Today I am extremely excited because I have just put a blog post live on the PHPNE website announcing our October event… Phil Sturgeon will be giving an introduction on FuelPHP, a new ‘kick ass’ (the words he used when I was talking to him on Friday night at the #NENT event) framework he is part of.

Why am I so excited? Two reason. Firstly, Phil is a leading developer on Codeigniter. Codeigniter changed my life. Secondly I have recently been getting a lot of ear ache from Chris Scott telling me that I should take a look at Ruby on Rails, talking to me about things like migrations, ORM and HAML… Phil is also a leading developer on FuelPHP… and guess what… Fuel introduces things like ORM and migrations and has support for things like HAML…

If you are interested in attending the event you will need to be quick because spaces are limited. Head to the PHPNE website for more information and register on EventBrite asap.

Codeigniter & Google Maps

I am currently working on a website that is based on bike routes. What basically happens is our client goes out and rides the route tracking the route with his GPS devise. He then downloads this GPS info into MemoryMaps and adjusts the route points as necessary. This information is then exported from MemoryMaps into a GPX file. The GPX file is then uploaded into our custom built backend along with some route information and a description and this route is then listed as a route. The first latitude and longitude imported from the GPX file is saved as the starting point and so an overview map can be shown of all the routes. When you click on one of the route starting points you get a little overview of the route and you can then click to view the full route page.

I am using Codeigniter for this project. I am obsessed with Codeigniter since I was introduced to it by @boxedfish. Its taken me a long time to move away from my own framework, but the move has been well worth it. There is an amazing PHP Google Maps API class which I have used in the past and I was about to get started on creating a Codeigniter library using this class when it crossed my mind to do a quick search in Google for one already built. Wise move! Google Maps API V3 Library already exists thanks to the good people at in-the-attic.co.uk.

Adding an overview map with a number of markers was one of the easiest implementations of Google maps I have ever done… however I got a little stuck when it came to the route information pages where I wanted to show the route points using polylines. A simple enough task!

I fired up the documentation (which is part of the original php class not the library by in-the-attic.co.uk)

$this->gmap->addPolylineByCoordsArray($poly_array,false,'#FF0000', '6', '0.5');

This should have done the trick. I simply get all the coordinates of my route, put them in an array and bing, bang bosh! I tried everything under the sun to get this to work but I could not get the polylines to display on the map, every time I tried to load the page the map would not load. I knew I was getting the information in the array but something was not right. I made a cry of help to twitter but nothing came back… I did what every good developer should do, I went away and worked on something else! Then it hit me, why not just open up the class file and look at the function that processes the $poly_array and see what format it should be in. It was then I realised that I was assuming that everyone called latitude ‘lat’ and longitude ‘lng’. In fact it was expecting ‘long’!

So for anyone else out there was is having problems, the correct array format for addPolylineByCoordsArray is:

$poly_array[] = array('lat' => $my_lat, 'long' => $my_lng);