Wednesday, September 2, 2009

REQUEST PARAMETERS

I was never happy with the way that Digitalus handled URI parameters. We handled them outside the scope of Zend_Controller_Front and then manually set the request params. This is an effective way, but not as elegant as fuller integration.

I just created a new resource plugin for the application which parses the URI, then creates a new instance of Zend_Controller_Request_Http, and sets it up approapriately.

You set the separator in your application.ini file like this:

resources.request.paramSeparator = "p"

Then you can pass URI parameters like this:

/page/subpage/p/param/1

The trick here is the fact that this is done prior to the front controller being dispatched; this means that the front controller is none the wiser that you altered the URI; the technique works for your CMS pages as well as the ZF application pages (which use MVC routing).

No comments:

Post a Comment