views:

177

answers:

4

I am developing a Zend MVC application.

Sometimes I like to echo some text just for quick and dirty debugging. e.g

<?php
class MyClass {}
echo('hello world - yes this script is included');

I can echo 'debug-text' in my bootstrap> But, when text is echoed in my model or controllers it is NOT being rendered in the output.

I am using Zend 1.9.5 and using Zend Layout with MVC


Is there a setting somewhere that is suppressing all ''non-view script rendered'' output?

A: 

If viewRendering is turned on, it's probably looking for the view/scripts/ to render and possibly not displaying your echo statements.

You could try to turn viewRendering off the given controller and see if that helps.

viewRenderer->setNoRender()
Mr-sk
+1  A: 

You can also use die() instead of echo :) it will work. Or use Zend_Log and output writer like this:

$writer = new Zend_Log_Writer_Stream('php://output');
Tomáš Fejfar
yep die() does the trick and makes me remove it pretty quickly too.
JW
but it's better to have a function that takes the callstact and fetches the location where the "die" was called (should be level-2) and then echo something like`Form_Contact::init(): line 56:NULL`Which makes it easier to remove these calls when doing some extended debuging without debuger :)
Tomáš Fejfar
A: 

Output buffering may be the culprit. Try:

echo 'my debug output';
flush();
Mike B