Attach FirePHP to magento


/ Published in: PHP
Save to your folder(s)

nice post, would do it a bit differently but using it currently as-is.


Copy this code and paste it in your HTML
  1. /**
  2. *
  3. * @author Branko Ajzele
  4. * @license GPL
  5. *
  6. * @param object $var Object we wish to debug in FireBug
  7. * @param string $label Nice little label we wish to add so we can see it in FireBug
  8. * @param string $style String holding one of values: "INFO", "ERROR", "TRACE", "EXCEPTION" , "TABLE"
  9. * @return void Return null if Mage::setIsDeveloperMode(false) otherwise return message to browser
  10. */
  11. function acl($var, $label, $style = "LOG")
  12. {
  13. if(Mage::getIsDeveloperMode())
  14. {
  15. $request = new Zend_Controller_Request_Http();
  16. $response = new Zend_Controller_Response_Http();
  17. $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
  18. $channel->setRequest($request);
  19. $channel->setResponse($response);
  20. /*
  21. * Start output buffering
  22. */
  23. Zend_Wildfire_Plugin_FirePhp::send($var, $label, $style);
  24. /*
  25. Style Description
  26. LOG Displays a plain log message
  27. INFO Displays an info log message
  28. WARN Displays a warning log message
  29. ERROR Displays an error log message that increments Firebug�s error count
  30. TRACE Displays a log message with an expandable stack trace
  31. EXCEPTION Displays an error long message with an expandable stack trace
  32. TABLE Displays a log message with an expandable table
  33. */
  34. /*
  35. * Flush log data to browser
  36. */
  37. $channel->flush();
  38. $response->sendHeaders();
  39. }
  40. else
  41. {
  42. return null;
  43. }
  44. }
  45. /* All you need to do is to place it inside the index.php file, the one inside the root Magento folder.
  46. You need to place it after Mage::setIsDeveloperMode(true); statement.
  47. Which by the way you need to uncomment (in development environment). That's it, your done. */

URL: http://ajzele.net/utilize-firebug-and-firephp-to-speed-up-magento-development

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.