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

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

Author Message

Patrick Kaiser

Thursday 04 September 2008 10:56:42 am

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


Best regards,

Patrick

André R.

Thursday 04 September 2008 12: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();

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Gabriel Finkelstein

Thursday 04 September 2008 3:24:26 pm

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-->*/

Patrick Kaiser

Thursday 04 September 2008 4:46:11 pm

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


Best regards,

Patrick

André R.

Thursday 04 September 2008 11:46:52 pm

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

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Mark Marsiglio

Saturday 13 September 2008 11:26:58 am

We add this to the end of our xml layouts:

{kill_debug()}

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

Patrick Kaiser

Sunday 14 September 2008 4:41:33 am

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

best regards,

Patrick


Best regards,

Patrick

Grégoire Paris

Tuesday 21 April 2009 1: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?