Pragmatism in the real world

Where to set up your view?

With Zend_Layout on the horizon, I've been looking at how to use it and it will remove the need for my own front controller plugin which I call SiteTemplate. As a result, I need to find a new home for the view customisation stuff I do in SiteTemplate. My current plan is to create a new front controller plugin called ViewSetup (for want of a better name!) that contains just the view setup stuff from… continue reading.

PHPAbstract

If you read DevZone, then you'll notice that Cal's looking for some PHP Abstract advertising. I'm always up for free books, so there's my link Cal! (Though I doubt that technorati picks up my little blog!) More seriously, PHPAbstract is worth listening to. Unusually for a podcast, each episode is short (around 10 mins) so that I actually get to listen to a whole episode without being distracted. They have episodes by many (lots?) well… continue reading.

PHPWM Social

I've just come back from the PHPWM social for this month. We meet monthly and alternate between social and technical meets. This month, we met at the Hopwood House pub in Alvechurch, south of Birmingham. We talked geek for a few hours and I highly recommend joining your local PHP user group as it's a great way to meet people who don't look askance at you when you mention MVC!

preg_last_error() returns No Error on preg_match() Failure

A question came up on a mailing list that I subscribe to that I thought interesting. Consider this code: <?php $result = preg_match("/href='(.*)", 'blah'); $error = preg_last_error(); if($error === PREG_NO_ERROR) { echo "No Error\n"; } else { echo "An Error Occurred\n"; } var_dump($result); The output is: Warning: preg_match(): No ending delimiter '/' found in /var/www/preg_test.php on line 2 No Error bool(false) As you can see the pattern passed to preg_match is invalid as it is… continue reading.

PHP Editors

Everyone has their favourite coding editor and as this topic has just come up on the Zend mailing list and comes up regularly on the Sitepoint forums, I thought I'd list the editors I use. For my main heavy lifting, I use Zend Studio. In my opinion, nothing can touch it's autocomplete functionality. I especially like the way that it uses phpdoc's @return construct for autocomplete on class objects that are returned from functions. Obviously,… continue reading.

PHP West Midlands Meeting

Last night was the first meeting of the West Midlands PHP User Group. The phpwm is a mailing list group of around 100 members and now we've placed some names to faces. Jono Bacon organised the meeting, and Open Advantage graciously hosted it and even provided food! To get us started, we had three short talks: David Goodwin of Pale Purple talked about Smarty and separation of business code from display code. Elliot of Open… continue reading.

Active Record

I've recently been working through the PHP|Architect's Guide to PHP Design Patterns and have decided to build my own version of an active record along the lines of the one in Ruby on Rails. It's turning into an interesting experience as I'm doing using Test Driven Development methodology. This is proving very useful as I don't really have a clue where I'm going with the design, and so having a series of tests for each… continue reading.

PHP Collaboration Project

Everyone else is talking about the PHP Collaboration Project, so I thought I would too! I think this should be fun. There are two strands from what I can tell: A framework. A Zend plugin for Eclipse I currently use Zend's Studio and think it's great. it's expensive though and, to be honest, the problems revolving around editing have long been solved. Eclipse is a nice enough IDE and I think it would be better… continue reading.

Quick and Dirty Profiling

Profiling the quick and dirty way works for me a lot of the time. Other times, Zend's profiler is better, but when I just want to work out which function is taking all the time, the following function peppered throughout my code tells me what's going on:

10 Years of PHP

Seems hard to believe that PHP is 10 years old! I know it's quirky and not "elegant" in a lot of ways, but it fits what I need to get done like a glove. I especially like how it doesn't get in the way of creating kick-ass applications for the web!