Friday, November 9, 2012

Re: Turning off Debugkit debug data in a specific instance

Replace the element method in /DebugKit/View/DebugView.php with the following:

/**
 * Element method, adds comment injection to the features View offers.
 *
 * @return void
 */
public function element($name, $data = array(), $options = array()) {
$out = '';
$isHtml = (!isset($this->request->params['ext']) || $this->request->params['ext'] === 'html');
$isAjax = ( ! empty($this->request->params['isAjax']));
if ($isHtml && ! $isAjax && Configure::read('debug')) {
$out .= sprintf("<!-- %s - %s -->\n", __d('debug_kit', 'Starting to render'), $name);
}

$out .= parent::element($name, $data, $options);

if ($isHtml && ! $isAjax && Configure::read('debug')) {
$out .= sprintf("\n<!-- %s - %s -->\n", __d('debug_kit', 'Finished'), $name);
}
return $out;
}

----------------------

This will turn off the "Starting to render" comments if the output is not HTML (as it was), is AJAX, or if debug is off.


On Tuesday, February 7, 2012 3:45:08 PM UTC-7, Chris Cinelli wrote:
I would like to turn off in a specific instruction $this->element(...) the behavior that the DebugKit has to add prepending line with "<!-- Rendiring xxx -->" etc.
The result of the element rendering goes in a string that should not have those HTML comments.
I would like to be able to keep the debug kit on except in that specific instance.

Is there a way to achieve that ?

Best,
    Chris   

--
--Everything should be made as simple as possible, but not simpler (Albert Einstein)

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate