Understanding the stack index for Zend Framework Controller plugins

July 15th, 2010

Zend Framework Controller plugins are a powerful way to inject logic into your controller system at various points, such as before and after an action dispatch. Plugins are run in the order they are added, though it is possible to change the order by defining a custom stack index. ZF internal plugins such as Zend_Controller_Plugin_ErrorHandler, which displays a nice Error 404 page, has a stack index of 100 to ensure it runs near the end of any plugin cycle. However, it’s not so obvious from the ZF manual how to set a custom stack index.
Read the rest of this entry »

Sub-modules in Zend Framework

June 20th, 2010

Following on from my post on Admin sub-modules I’ve refactored the code into a more generic sub-modules system. And fixed some bugs!

Its main features are:

  • Organise modules into sub-folders where you need to support a complex collection of controllers, views, models, etc
  • Supports URLs in the format: /sub-module/module/controller/action
  • Supports ID route: /sub-module/module/controller/action/id
  • Registers controller folder to support above URLs
  • Autoloads module resources (using Zend_Application_Module_Autoloader) in the format: submodulenameModulename_Resource (i.e. AdminUser_Form_Registration)

This supports URL routes such as:

www.domain.com/admin/user/ ->
application/admin-modules/user/controllers/IndexController.php

www.domain.com/cms/news ->
application/cms-modules/news/controllers/IndexController.php

It’s a bootstrap resource that can be enabled in your application.ini file as so:

; 'admin' key is the name of sub-module group = path to sub-modules directory
resources.subModules.admin.directory = APPLICATION_PATH "/admin-modules"

Zend Framework Application Patterns at DPC10

June 11th, 2010

I’m currently in the fine city of Amsterdam enjoying what is incredibly my first PHP conference in ten years of developing with the language! Yesterday was tutorial day, with the full conference starting today, and I sat in Zend Framework Application Patterns by the informative and engaging Matthew Weier O’Phinney and Rob Allen.

The session was excellent, well worth attending, and dipped into many areas of ZF. Some of which I knew already, but there was certainly enough good tips on how to organise applications efficiently in ZF which I’ll be telling my team all about when I get back to the UK.

My notes from the tutorial day appear below, be warned they are rather long! You can also review the Zend Framework Workshop slides over at Slideshare.
Read the rest of this entry »

Admin sub-modules in Zend Framework

June 8th, 2010

Modules in Zend Framework essentially allow us to organise a collection of controllers into sub-folders, giving URL to filesystem mapping such as:

domain.com/user/register -> app/modules/user/RegisterController.php

While useful when we need to expand our URLs (and organisation of code) beyond one set of controllers, there are a few things they don’t currently solve which I think would make them first-class citizens within ZF.
Read the rest of this entry »

Falling foul of special characters

June 1st, 2010

These days its pretty standard to require support for multiple languages and special characters on your website. But it’s still terribly easy to trip up and make mistakes, usually indicated by weird characters popping up across your web content. Here’s a few tips on how to sort out your character encoding.
Read the rest of this entry »

Designers vs Developers

May 2nd, 2010

Last Thursday I participated in the latest CamCreative meetup, an evening of debate entitled “Designers vs Developers”. The evening was run by Nick Welsh who had prepared a number of problems that designers have with devs and vice versa. The idea was these questions would be discussed by the audience in roughly two halves of designers and devs and then Steve O’Connor (designer camp) and I (developer camp) would air our collected views to varied heckling.
Read the rest of this entry »

Barcamb 3

April 25th, 2010

I attended my first barcamp this weekend, Barcamb 3 at the superb offices of Red Gate in Cambridge. As a barcamp newbie I was a little unsure of what to expect but the whole weekend was great fun, full of an interesting, open and welcome bunch of folk, well organised and a thoroughly enjoyable experience. Read the rest of this entry »

Standards marching on

April 11th, 2010

With the launch of the iPad one of the striking things to me is its reliance on web standards. Apple’s own Technical Note on preparing websites for the iPad specifically states web developers should be using web standards for audio and video, specifically the HTML5 video and audio tags. If a large corporation like Apple is basically forcing web developers to use standards-based techniques to deliver content like video, chances are people will listen.

In this day and age you’d think standards was the assumed approach for all web agencies. From my experience, hardly so. Only last week I encountered two appalling coded sites via potential clients. One using tables for layout with no meaningful ALT text for images, the other a single image in a page with no text behind it (a 100% wide image too, which technically would work on an iPhone or iPad but be pretty much unreadable to everyone!). Both of which were from companies who claim to build websites as part of their professional services.

After following tweets from what sounded like an excellent An Event Apart, I heard about Eric Meyer’s talk on using media queries to deliver specific CSS depending on the device width or orientation. This means it’s possible to create flexible layouts for desktop and mobile simply with CSS (i.e. switching between a three column layout for desktop and a one column for mobile). Another great reason for using standards when developing for mobile or the iPad.

You can find out more about device orientation on Peter-Paul Koch’s site. There’s a summary of Eric’s talk over at Luke Wroblewski’s blog.

Apps closing on the iPhone

November 19th, 2009

I’ve just got my new shiny iPhone with Orange and am of course very happy with the UI, the apps and the amazing connectivity it gives you on the move. However, pretty rapidly after installing various apps I hit the problem of all installed apps closing immediately after opening them. Not good.
Read the rest of this entry »

Multiple accounts for my.rackspace.com

November 6th, 2009

We host most of our client sites at Rackspace so we have a fair few servers and different accounts we need to login with whenever accessing the my.rackspace.com portal.

While the site has a cookie to remember the last entered account number and username, it doesn’t help if you have half a dozen different accounts you need to login with on a frequent basis. Switching browsers can be impractical and remembering the account IDs can just get tiring.

To solve this problem I created the My.Rackspace bookmarklet for logging in with multiple accounts. When clicked it takes you to my.rackspace.com. If you’re already there, it displays a select list of your different accounts and populates the login form once you’ve chosen.
Read the rest of this entry »

  • me

    I run web agency Studio 24 and I blog occassionally about PHP, web standards, usability and general web development.

© Simon R Jones 2005-2010, Entries (RSS)

contact me on , Twitter, Linkedin