[Howto] Microdebuger for RazorCMS files ;-) [PHP]

Find How to do something.

[Howto] Microdebuger for RazorCMS files ;-) [PHP]

Postby Adminer » Thu Jun 30, 2011 10:36 pm

Hi!

Sometimes I need some information about how RazorCMS works, or when I write my new bladepack.

It's good function to use to test php and learn:

Code: Select all
//// Razor microdebuger    ////
   function see($rvariable){
        echo('<pre>');
      echo "\n $rvariable";
   // var_dump(debug_backtrace());       
      print_r($rvariable);
        echo('</pre >');
        $d = debug_backtrace();
        echo $d[0]['file'] . '<br />Line: <b>' . $d[0]['line'] . '</b>';
   //   debug_print_backtrace();
        echo '<hr />';
   }
// end ////////////////////////////////


Usage:

You can find something to test, for example php file with this function:

// read all dir recursively and return dir only //
function readAllDirR($dir) {
$imageFiles = array();
$imageContents = opendir($dir);
if (! $imageContents) {
die('Cannot list files for ' . $dir);
}
...
closedir($imageContents);
return $imageFiles;

So you can put inside that php file that function and test the value:

// read all dir recursively and return dir only //
function readAllDirR($dir) {
$imageFiles = array();
$imageContents = opendir($dir);
...
closedir($imageContents);
see($imageFiles);
return $imageFiles;

And If you are lucky and this function run ok - you can see the value of $imageFiles on your screen.
I like it :D
Adminer
 
Posts: 578
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Return to How-To's



Who is online

Users browsing this forum: No registered users and 2 guests

cron