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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Turning off Debugkit debug data in a specific instance
The real content is not just a string like This is my awesome string but has a few variables and associated conditions. This is actually a little exception because it is not usually something I assign to a javascript variable. I use elements when the result should be render initially in the view and later in response of an ajax call that update the elements so I can use query to update the object. ex: index.ctp: ... div id=myAwesomeDiv element('DoneShare/completed', array('completed_time' = $completed_time)) /div ... ajax_update.ctp $ret = array('status' = 'ok', 'html' = element('DoneShare/completed', array('completed_time' = $completed_time)) ); echo json_encode($ret); And with jquery I do something like $(#myAwesomeDiv) .html(data.html); in the success callback of the ajax call. On Wed, Feb 8, 2012 at 1:13 PM, AD7six andydawso...@gmail.com wrote: On Feb 8, 8:54 pm, Chris Cinelli chris.cine...@formativelearning.com wrote: BTW, the a patch is using: preg_replace ('/!--.*--\s/', '', $this-element(...)); but it seems a little an overkill On Wed, Feb 8, 2012 at 11:44 AM, Chris Cinelli chris.cine...@formativelearning.com wrote: Just to clarify this is what Ia trying to do: In the view I have script var completedText = '?= $this-element('DoneShare/completed', array('completed_time' = $ completed_time)) ?'; /script This work well when the DebugKit is not active producing this output: script var completedText = 'This is my awesome string!'; /script But when the DebugKit is active, it render like: var completedText = '!-- Starting to render - DoneShare/completed -- This is my awesome string !-- Finished - DoneShare/completed -- '; that produce a javascript error. Since I would like to keep the debug kit on in development, it would be nice if I can turn off the rendering of the debugging comments just for that specific element. Any solution for that? Best, Chris On Tue, Feb 7, 2012 at 2:45 PM, Chris Cinelli chris.cine...@formativelearning.com 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) -- --Everything should be made as simple as possible, but not simpler (Albert Einstein) -- Everything should be made as simple as possible, but not simpler (Albert Einstein How about not using an element for returning data (elements are not designed to do that) and instead using a helper function? AD -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- --Everything should be made as simple as possible, but not simpler (Albert Einstein) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Turning off Debugkit debug data in a specific instance
On Feb 9, 9:21 am, Chris Cinelli chris.cine...@formativelearning.com wrote: The real content is not just a string like This is my awesome string but has a few variables and associated conditions. Same question AD -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Turning off Debugkit debug data in a specific instance
Just to clarify this is what Ia trying to do: In the view I have script var completedText = '?= $this-element('DoneShare/completed', array('completed_time' = $completed_time)) ?'; /script This work well when the DebugKit is not active producing this output: script var completedText = 'This is my awesome string!'; /script But when the DebugKit is active, it render like: var completedText = '!-- Starting to render - DoneShare/completed -- This is my awesome string !-- Finished - DoneShare/completed -- '; that produce a javascript error. Since I would like to keep the debug kit on in development, it would be nice if I can turn off the rendering of the debugging comments just for that specific element. Any solution for that? Best, Chris On Tue, Feb 7, 2012 at 2:45 PM, Chris Cinelli chris.cine...@formativelearning.com 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) -- --Everything should be made as simple as possible, but not simpler (Albert Einstein) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Turning off Debugkit debug data in a specific instance
BTW, the a patch is using: preg_replace ('/!--.*--\s/', '', $this-element(...)); but it seems a little an overkill On Wed, Feb 8, 2012 at 11:44 AM, Chris Cinelli chris.cine...@formativelearning.com wrote: Just to clarify this is what Ia trying to do: In the view I have script var completedText = '?= $this-element('DoneShare/completed', array('completed_time' = $ completed_time)) ?'; /script This work well when the DebugKit is not active producing this output: script var completedText = 'This is my awesome string!'; /script But when the DebugKit is active, it render like: var completedText = '!-- Starting to render - DoneShare/completed -- This is my awesome string !-- Finished - DoneShare/completed -- '; that produce a javascript error. Since I would like to keep the debug kit on in development, it would be nice if I can turn off the rendering of the debugging comments just for that specific element. Any solution for that? Best, Chris On Tue, Feb 7, 2012 at 2:45 PM, Chris Cinelli chris.cine...@formativelearning.com 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) -- --Everything should be made as simple as possible, but not simpler (Albert Einstein) -- --Everything should be made as simple as possible, but not simpler (Albert Einstein) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Turning off Debugkit debug data in a specific instance
On Feb 8, 8:54 pm, Chris Cinelli chris.cine...@formativelearning.com wrote: BTW, the a patch is using: preg_replace ('/!--.*--\s/', '', $this-element(...)); but it seems a little an overkill On Wed, Feb 8, 2012 at 11:44 AM, Chris Cinelli chris.cine...@formativelearning.com wrote: Just to clarify this is what Ia trying to do: In the view I have script var completedText = '?= $this-element('DoneShare/completed', array('completed_time' = $ completed_time)) ?'; /script This work well when the DebugKit is not active producing this output: script var completedText = 'This is my awesome string!'; /script But when the DebugKit is active, it render like: var completedText = '!-- Starting to render - DoneShare/completed -- This is my awesome string !-- Finished - DoneShare/completed -- '; that produce a javascript error. Since I would like to keep the debug kit on in development, it would be nice if I can turn off the rendering of the debugging comments just for that specific element. Any solution for that? Best, Chris On Tue, Feb 7, 2012 at 2:45 PM, Chris Cinelli chris.cine...@formativelearning.com 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) -- --Everything should be made as simple as possible, but not simpler (Albert Einstein) -- Everything should be made as simple as possible, but not simpler (Albert Einstein How about not using an element for returning data (elements are not designed to do that) and instead using a helper function? AD -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Turning off Debugkit debug data in a specific instance
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) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php