Sep 21, 2013
  • For debugging purposes, you have the following possibilities.

    Fabrik debug mode(top)

    discussed here...

    PHP debug(top)

    for example in PHP validation plugins.

    You can use the following methods :

    1) Use Firebug in Firefox.(top)

    to display variables, you can use the PHP var_dump() function :
    Code (Text):
    var_dump($my_var1); exit;
    var_dump($my_var1, $my_var2); exit;
    var_dump("MY_VAR : ",$my_var1); exit;
    At form submission, this will stop the execution of the plugin and you will get the following error on your form :
    SyntaxError: JSON.parse: unexpected character

    In Firebug, in "Console menu / All", you will see a POST with
    SyntaxError: JSON.parse: unexpected character

    Click on the '+' before POST. You will see a new menu, by default on "Response" tab. Click on "HTML" tab, you will see your dump in a more visible way.

    If you want to display many variables, you can write :
    echo "found : ".$found."\n";
    echo "status : ".($status); exit;
    The "\n" is to display the next variable on a new line.
    And don't forget to write "exit;" on the last line !

    2) Use J!Dump extension(top)

    For a smarter use, install J!Dump, it will allow you to display a popup window, without stopping the execution of your code.
    Just insert in your code something like :
    Code (Text):
    dump($variable, 'Variable Name');