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 »

  • me

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

  • you are currently browsing the simon r jones blog archives for June, 2010.

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

contact me on , Twitter, Linkedin