ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Debug helper

September 26, 2009 8:42am

Subscribe [5]
  • #1 / Sep 26, 2009 8:42am

    Crimp

    320 posts

    A helper for debugging during development. Suitable for CI beginners and everyone else.

    Save code below to file, name as debug_helper.php and put in your /system/application/helpers folder.

    Recommended usage is to autoload this helper in system/application/config/autoload.php.

    This makes it easy to turn debugging on and off.

    Call these methods anywhere: models, views and controllers.

    </pre>
    									
  • #2 / Oct 19, 2009 9:48am

    John_Betong

    690 posts

     
    I like many of the functions that are used and have started to use them already.
     
    I have developed a routine which I use extensively to find the values of any type of variable, integer, string, array or object.
    It is easy to use, just type fred(‘whatever variable type you have’);
     
    I include it in my index.php with require(‘_fred.php’) and it makes it available to view the CodeIgniter source code.
     
    Give fred(...) a try // named because it is very easy to type.
     
    _fred.php

    </pre>
     
     
     
    edit: added screen dump
    									
  • #3 / Oct 20, 2009 12:44pm

    hugle

    289 posts

    Cute and simple 😊


    thank you very much!

    p.s. I like the colors:))

  • #4 / Nov 13, 2009 12:00pm

    blackgoo

    10 posts

    found it useful as for a befinner 😊
    helps to find a problematic lines in the code if to use correctly.
    i like it
    thank you.

  • #5 / Jan 04, 2010 4:04am

    sandeep nami

    18 posts

    Thank you vary much John_Betong
    😊

  • #6 / Nov 02, 2010 5:05pm

    woeps

    4 posts

    I really like your helper! Thanks!
    But I had to change the echo-statements to put the whole output of each method into a variable and then return this; because if I echo the ouput there will be problems using sessions or “not-default” header.
    Now the methods look like this:

    </pre>
    Now I can use this helper with sessions, redirects, etc.
    Thanks!
    									
  • #7 / Dec 06, 2011 12:52pm

    A very simple debug every data type

    <?php
    
    if (!defined('BASEPATH'))
        exit('No direct script access allowed');
    if (!function_exists('debug')) {
    
        function debug($data) {
            $dub = debug_backtrace();
                   
            echo '<pre><span>';
            echo $dub[0]['file'] . "<br>On Line Number ";
            echo $dub[0]['line'] . "<br></span>";
            print_r($data);
    
            echo '</pre><p>‘;<br />
        }</p>
    
    <p>}<br />
    ?>
    </pre>

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases