Pragmatism in the real world

Busy

I'm kind of neglecting this blog at the moment. Sorry. I was away last week and I'm head down into editing Zend Framework in Action. It's amazing how many details the technical proof reader and our copy editor have found. The book is going to be so much better as a result. I need to go through each suggestion though and ensure that the meaning hasn't changed and to implement the suggested technical changes. When… continue reading.

Recursion

PHPWomen are running an article contest at the moment. All you have to do is write an article for the Best Practices forum and you could win a Zend Studio for Eclipse license and a a 1-year subscription to Linux Pro magazine! Obviously, never one to miss an opportunity to win free swag, I've entered with an article on recursion. Now it's your turn. Write a article on a best practice when coding PHP, but… continue reading.

Notes on Zend_Cache

Recently I needed to speed up a legacy project that makes a lot of database calls to generate each page. After profiling, I discovered that 90% of the database calls returned data that rarely changed, so decided to cache these calls. One of the nice things about Zend_Framework is that its use-at-will philosophy means that you can use any given component with minimal dependencies on the rest of the framework code. In my case, I… continue reading.

UK Readers: Don't buy petrol from BP or ESSO

This is very off-topic, so feel free to skip! Received a round-robin today via email. As I don't send on such things, I thought I'd mention it here as I'm getting fed up with the price of petrol, especially given the profit that the big oil companies have recently announced: Received from a good friend so leave the rest to you! See what you think and pass it on if you agree with it. We… continue reading.

Zend Framework URLs without mod_rewrite

Some of our Zend Framework applications have to run on IIS without ISAPI_Rewrite installed. In these cases we need urls of the form http://www.example.com/index.php?module=mod&controller=con&action=act. I couldn't get this to work out of the box with Zend Framework 1.5, so wrote my own router called App_Controller_Router_Route_RequestVars. This code obviously only supports what I needed and I've only tested it on IIS for Windows 2003 Server, so you may need to tweak to make it do what… continue reading.

Top Tip: XHTML with Zend Form Elements

When you render a Zend_Form, the elements will render to HTML compliance rather than XHTML compliance, even if you have < ?php echo $this->doctype('XHTML1_STRICT');?> at the top of your layout script. Practically, this means that all the input elements do not end in "/>". To resolve this, you need to call the doctype() view helper prior to rendering your form. Within my projects, I do this within a front controller plug-in called ViewSetup that looks… continue reading.

Simple Zend_Form File Upload Example Revisited

I've been thinking about the Simple Zend_Form File Upload Example that I discussed last month. To recap, if you haven't read the comments, if the form fails to validate for some reason then you get a nasty error: Warning: htmlspecialchars() expects parameter 1 to be string, object given in /Users/rob/Sites/akrabat/Zend_Form_FileUpload_Example/lib/Zend/View/Abstract.php on line 786 Essentially, what is happening is that the App_Form_Element_File class that we wrote assigns the $_FILES array to the $value parameter for the… continue reading.

A review of "Learning PHP Data Objects"

Packt Publishing recently sent me a couple of books to review. This post is about the second one I received, Learning PHP Data Objects by Dennis Popel. I was excited to receive this book as PDO underlies a lot of the Zend_Db_Adapter objects that I use in my day to day programming. It seemed like a good idea that I should know more about it. Overview of the book This book starts out introducing PDO… continue reading.

A review of "Object-Oriented Programming with PHP5"

Packt Publishing recently sent me a couple of books to review, so let's start with Object-Oriented Programming with PHP5 by Hasin Hayder. According to the introduction, the book is intended for beginners to intermediate PHP5 programmers and the first chapter has a good introduction to what object oriented programming is and why you would want to use it. Overview of the book Chapters two and three of the book are an excellent discussion of how… continue reading.

Flickr Uploadr

The new Flickr Uploadr was written using Xul. Richard Crowley has put up a post at the Flickr blog with links to various articles that he's written about devloping with XUlrunner. Fascinating stuff and a must read for anyone who writes Xulrunner apps. Even better, the full source to Uploadr is available!