Phil Brown's Web Development Blog

Entries for the ‘PHP’ Category

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 most robust [...]

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 the [...]

Roundcube 0.3-stable on PHPsuExec hosts

I’ve been using Roundcube as my webmail client since the early alpha days and was happy to see the recent release of 0.3-stable. I did have to tweak some PHP configuration items so, for the benefit of other Roundcube users, here’s how to get it up and running on a PHPsuExec enabled host.
As outlined in [...]

PHP suExec and custom php.ini files

Lately, I’ve noticed more and more shared web hosts making the switch to running PHP under suExec. The benefits of this are:

PHP scripts run as the owning user
No more file system permission juggling
Scripts are generally sandboxed to the owner’s home directory

Unfortunately, this poses a problem for any custom PHP configuration changes as the usual .htaccess [...]

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 standard [...]

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 content [...]

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 various ways [...]

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 second query [...]