eZ Community » Forums » Developer » Disable debug for custom layouts...
expandshrink

Disable debug for custom layouts (/layout/set/xyz)

Disable debug for custom layouts (/layout/set/xyz)

Thursday 04 September 2008 7:56:42 pm - 7 replies

Hi,

does anyone know how to disable debug for custom layouts? We use custom layouts mostly for serving xml and json content which of course is not valid anymore once ez writes its debug output in it. This is only a problem during development, but its just anoying having to en/disable debug output all the time..

Thanks for any hint, best regards,

Patrick

Thursday 04 September 2008 9:13:23 pm

Use a custom view, you can reuse the concepts from oe5, for instance.
outputs debug output as text in a javascript comment.

// Output debug info as js comment
echo "/*\r\n";
eZDebug::printReport( false, false );
echo "*/\r\n";

// output (echo) view result here

eZDB::checkTransactionCounter();
eZExecution::cleanExit();

Modified on Thursday 04 September 2008 9:14:04 pm by André R.

Friday 05 September 2008 12:24:26 am

The debug replaces this code:

<!--DEBUG_REPORT-->

in the pagelayout with the debug info. So, for your xml pagelayouts you could put:

<!--<!--DEBUG_REPORT-->-->

And for your json pagelayouts:

/*<!--DEBUG_REPORT-->*/

Friday 05 September 2008 1:46:11 am

Thanks very much for your help!

Furthermore, wouldn't it be good to have a ini setting in layout.ini to en/disable debug for each custom layout? For xml and json output the normal ezdebug output doesnt make too much sense anyway..

Best regards,

Patrick

Friday 05 September 2008 8:46:52 am

/layout/set aren't made for json/xml views, but this is of course something to keep in mind for projectV.

Saturday 13 September 2008 8:26:58 pm

We add this to the end of our xml layouts:

{kill_debug()}

Sunday 14 September 2008 1:41:33 pm

interesting, would you mind to post the code of the kill_debug() template operator as well?

best regards,

Patrick

Tuesday 21 April 2009 10:02:46 am

Hi, I have tried to use the solutions proposed here, but none of them worked for me, so I have tried this :

include_once ('kernel/common/template.php');

$tpl = templateInit();

$Result=array();
$Result['pagelayout'] = "";
$old_level      = error_reporting(0);
$ezDebugObject  = eZDebug::instance();
$old_output     = $ezDebugObject->MessageOutput;
$ezDebugObject->setMessageOutput( eZDebug::OUTPUT_MESSAGE_STORE );
if( extension_loaded('xdebug') )
    xdebug_disable();
$Result['content']    = $tpl->fetch( 'design:clipping/export.tpl' );
$Result['path']       = array(array('url'=>'clipping/export','text'=>"Clipping"));
$ezDebugObject->setMessageOutput( $old_output );

, which did work on another project where I did not have to use templates. Why does not it work with templates? Isn't it possible to disable debug output in php for a given template?

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu