Pragmatism in the real world

Zend Framework in Action forum and errata

Although I'm not posting here much at the moment, I am answering questions about my Zend Framework book in Manning's Author Online forums. There's a fairly active discussion going on as readers find areas that they are struggling with and I do my best to contribute to most of the threads when I can. Also, if you missed it, I have a post containing the errata that we have found. If something doesn't make sense,… continue reading.

Catching-up

Since the New Year, I've been very busy and have had little time for coding. One reason is that I decided to take a photo every single day of this year. It's proving fascinating, but is taking up more time per evening than I realised. Of course, as I get into the swing of things, the time taken choosing which image(s) to post and then processing them will go down :) If you are interested,… continue reading.

Seven Things – Tagged by Matthew

Like Matthew Weier O'Phinney, I don't really understand these tagged memes either, however, after he said such nice things about me, I thought I'd have a go. Seven things you may not know about me: My first programming job was programming PIC microcontrollers using Forth. Forth has been one of the more confusing languages that I've used. The first search engine I used was Gopher on a SparcStation 1 in 1991… My most expensive telephone… continue reading.

2008 in pictures

Everyone appears to do end-of-year wrap-up posts about this time of year, so I thought I would do one too… January We started the year with a trip to the zoo. I attempted to get a photo of a waterfall with that blurry water you see the good photographers do. February The highlight of February was talking at the UK PHP Conference in London. March A quiet month with most weekends doing something with the… continue reading.

On models in a Zend Framework application

Let's talk about writing models that communicate with databases within a Zend Framework application. It's a popular topic at the moment as there's been a few threads recently on the ZF mailing lists about creating models. The "is a" relationship When working with models within Zend Framework, the simplest solution is to extend Zend_Db_Table_Abstract and Zend_Db_Table_Row_Abstract along these lines: class Users extends Zend_Db_Table_Abstract { protected $_name = 'users'; protected $_rowClass = 'User'; public function fetchAllInLastNameOrder()… continue reading.

Zend Framework in Action Errata

Note that ZFiA was written for version 1.5 of Zend Framework. If you are using version 1.8 or later, then please read this article on Zend Loader. This is a list of issues that we are aware of: Chapter 2 On page 18, the right hand bracket in the first paragraph is not needed. On page 38, in the last code block, the first line of the method should be: $cutOff = date('Y-m-d', strtotime('-3 months'));… continue reading.

File uploads with Zend_Form_Element_File

Now that Zend Framework 1.7 has been released, I thought I'd take a look at the built in file upload element, Zend_Form_Element_File, and see how it can be used. This is how to use it in its most basic form. I decided to use the same set of form elements as before in order to make things easy. Let's start with the form: The form We extend Zend_Form and store it in the application/forms folder… continue reading.

PHPNW08 Conference

PHPNW 08 took place last Saturday, and even though I wasn't too well, I had a great time. I thought my talk went okay, and judging from the feedback, at least some people learnt something from it which is good. I hope that the tongue-in-cheek references to my book were taken in the light-hearted manner intended. The conference seemed well-attended and the organisation was top-notch. Jeremy, Jenny, Emma, Lorna and everyone else involved did a… continue reading.

Hooks in Action Helpers

Following on from the discussion on Zend Framework Action Helpers, let's talk about hooks within them. Hooks are a feature of action helpers that allow you to automatically run code at certain points in the dispatch cycle. Specifically, there are two hook functions available for action helpers: preDispatch(): runs before the action function is called postDispatch(): runs after the action function has completed These allow you to ensure that some functionality is always run for… continue reading.

Using Action Helpers in Zend Framework

When you have some functionality that needs to be shared across multiple controllers, one method is to use action helpers. Action helpers are very powerful and contain hooks to automatically run when you need them too, but you can ignore all that if you don't need it. The first thing you need to do is decide where to put them. The latest default project structure document recommends using a sub folder from your controllers directory.… continue reading.