Category Archives: Zend

Difference between Zend_debug and Zend_log

Zend_Debug is a very simple component that provides a quick way to dump variables to screen for ad-hoc debugging.

Zend_Debug::dump($_Server, 'SERVER VARS', true);

Above command will dump out the $_server array with the label SERVER VARS

Zend_Log
Zend_Debug is very good for ad hoc debugging. For more permanent debugging, we can use Zend_Log. Zend_Log has some greate features, including Firefox Firebug stream writer that enables us to log to the Firebug console.
$log = new Zend_Log(
new Zend_Log_Writer_Stream('php://output')
);

Multiple loggers and the ability to define your own events and log levels are also included in its features.

Difference between render and partial

$this->render ('topnav.phtml')
$this->partial('topnav.phtml')

Render has the same variable scope as the script from which it is being called. Therefore, we must be careful of variable clashes. while partial helper render a view script within its own scope. There is one downside to partial helper though, it has to clone a lot of objects to get the view into its own scope, which means there is a performance hit while using it.