Phil Brown's Web Development Blog

Entries for the ‘Zend Framework’ Category

Where’s my Front Controller?

I’ve been spending a bit of time on StackOverflow lately and have even earned myself a bronze “Zend Framework” badge. One thing I continually see in questions surrounding the bootstrap process and resource plugins is this… protected function _initSomething() { $front = FrontController::getInstance();   // and so on This is not the right way to […]

Awesome Pagination with ZF, Paginator, AjaxContext and the HTML5 History API

One of my favourite components in Zend Framework is the AjaxContext action helper. This little beauty allows you to intercept AJAX requests and deliver a different view based on request parameters, all without touching a single line of action code. One scenario where this has always appealed to me is in paginating data. Why reload […]

Zend Framework and Doctrine Part 1

I’ve begun to investigate the Doctrine ORM library and how to integrate it into Zend Framework applications. I figure this post and any subsequent ones on the topic can grow into some sort of discovery series. So, my first post is going to be a simple one – bootstrapping with Doctrine 1.2. I figured the […]

Overriding Zend form element default decorators, for good!

I’m sure everybody who has used Zend_Form has, at one time or another, wished they could change the default form element decorators in one fell swoop, simply and efficiently. Up until now, I’ve been using one of two methods to override the default “definition list” style; set each element’s decorator scheme on instantiation or, use […]

Extending Zend Framework Application Resource Plugins

With the arrival of Zend Framework version 1.8 came the application resource plugins. These nifty little classes help bootstrap your application’s resources (views, layouts, database connections, etc). The default behaviour is suitable for most needs however, occasionally, you’re going to want to perform some extra functionality. Take for example the following use case – the […]

Changing layouts with Zend ContextSwitch

Ever since discovering Zend Framework’s ContextSwitch and AjaxContext action helpers, I’ve been hooked. What’s not to love about writing one controller action and having the request dictate the response format. Whilst this generally does the job for XML, JSON and AJAX HTML snippets where any layout is disabled, sometimes you just need to wrap that […]

Zend Framework Forms and magic_quotes_gpc

Introducing the bane of my existence – PHP’s magic_quotes_gpc. I won’t bore you with the details suffice to say that this is one of PHP’s greatest failings and I cannot wait until the world adopts PHP6 and this awful blight is removed forever. Until then, we’ll just have to deal with it. Now, there are […]

Zend Framework: Automatically fetch the grand total from a limit query

September 11, 2008 – Updated for Zend Framework 1.6 So you’ve got a nice limited result set for use in a paginated display. The thing with most pagination widgets is they need to know the grand total for determining the total number of pages. What you would normally have to do is manually issue a […]