Steven Brown

Archive for July, 2009

Zend Framework Performance Architecture Part 4: Denormalisation using the Observer Pattern

by on Jul.18, 2009, under Zend Framework

In the previous Zend Framework Performance Architecture articles we’ve covered some structural changes you can make to improve the performance of your code by applying caching and denormalisation of data. The examples in these articles made a point, but will quickly become a maintenance nightmare.

One rule I like to follow with my development is to make each class responsible for itself as much as possible, this way I can add/remove/change everything related to that class in one place (mostly). This is generally known as loose coupling.
(continue reading…)

Leave a Comment more...

Q&A – Something’s wrong with my output buffering!

by on Jul.14, 2009, under PHP, Zend Framework

Question:
Something’s wrong with my output buffering! I have a Zend Framework project with a long script and I’m trying to output stuff in the controller during the process but it doesn’t appear until the end. I tried using flush() and moving the code to the view but it made no difference. What is going on?

Answer:
First of all Apache on Windows doesn’t respond to flush(), it will always wait until the end of the request to output the result.

For other system though what you should know is that by default the Zend Framework front controller will buffer all output. This is normally fine and actually is quite useful, however there are some situations where you will want to bypass output buffering. In order to do this you should place the following in your bootstrap:

$frontController->setParam('disableOutputBuffering', true);

Now I like to do this only if a certain $_GET variable is sent so that I can apply it to any URL at will, however you might like to use a plugin to permanently disable output buffering for URLs that require it.

2 Comments more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!