Oliver Read

Websites that work for you

Happy belated new year!

It’s been a long time since I updated the site but I’ve been busy and have launched a few sites. See them over in my portfolio.

I’m also in the middle of several jobs including a directory that helps vulnerable people find services, an online art shop and a site for the local tennis club so watch this space. I’ve also decided to finally build a site for my board game group – Portsmouth on Board. I’m probably going to modify the P2 theme which is ideal for posting quick messages to a group, but it’s not as static and clunky as a forum.

In the meantime, here’s another AEOT:

Drupal as an application framework

When a client approached me to build a site that could list hundreds of different services and filter them I immediately thought it was a great excuse to use CakePHP. But they also need a lot of standard web pages with a good content management system behind them so I started to think how I could do this with my go-to CMS, WordPress. It could probably be done with WP’s categories and tags but they would need a fair amount of customisation and I’d probably have to write a plugin to cope with situations like showing content tagged with several different tags.

While comparing application frameworks I came across Ben Buckman’s post about using Drupal. I think it piqued my interest because of the way he was told that Drupal wasn’t suitable for entering the framework bakeoff but he went ahead and entered anyway, albeit from the back of the auditorium!

Continue reading »

Online boardgame framework

Even though I’ve been incredibly busy with freelance work over the last couple of months, I’ve somehow found time to begin work on a system for playing boardgames through the web browser. This is something I’ve wanted to do for years but it’s only now that I feel I have the knowledge to achieve it on my own. I’m using the CakePHP framework and learning a lot of it as I go.

Continue reading »

CakePHP – containable behaviour

In building a CakePHP app to learn the framework I’d been searching for about a day for the best way to retrieve data from related models. I came across the recursive attribute which returns all related data to a given depth. Using this appears to be hugely wasteful as the same data is likely to be fetched many times over so I continued to look for a better way.

I eventually found the containable behaviour buried away in the manual. After reading through a few times to get my head around the concept, it seems to be the answer to all my CakePHP worries.

You simply tell it which models to pull in at each step so you only retrieve the data you ask for. A bit of effort here will save a lot of database requests.

$this->Game->contain(array(
  'Character' => array(
    'User' => array(
      'fields' => 'username'
    )
  ),
  'Post' => array(
    'Character' => array(
      'User' => array(
        'fields' => 'username'
      )
    )
  )
));

I love CakePHP. There, I said it.