How do you make Zend Framework NOT render a view/layout when sending an AJAX response?

Call this code from within whatever Action(s) is/are going to be sending AJAX responses: $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); This disables the Layout engine for that action, and it turns off automatic view rendering for that action. You can then just “echo” whatever you want your AJAX output to be, without worrying about the normal view/layout stuff getting … Read more

Is there a way to do an “INSERT…ON DUPLICATE KEY UPDATE” in Zend Framework 1.5?

I worked for Zend and specifically worked on Zend_Db quite a bit. No, there is no API support for the ON DUPLICATE KEY UPDATE syntax. For this case, you must simply use query() and form the complete SQL statement yourself. I do not recommend interpolating values into the SQL as harvejs shows. Use query parameters. … Read more

Set Application_ENV via virtual host config and read this in PHP

Since SetEnv set’s the value to Apache’s environment, you can get it with apache_getenv — Get an Apache subprocess_env variable or just getenv — Gets the value of an environment variable If you look at public/index.php in a ZF project, you will see ZF uses getenv: // Define application environment defined(‘APPLICATION_ENV’) || define(‘APPLICATION_ENV’, (getenv(‘APPLICATION_ENV’) ? … Read more