Simple using print_r or var_export , you can debug code within Drupal.
<?php
$node = node_load(123);
print_r($node);
?>
Drupal devel module provides dsm and dpm functions to debug code within drupal.
<?php
$node = node_load(123);
dpm($node);?>
drupal latest version provides debug inbuilt function to print errors, notices and warnings as well.This could be in the page or in the logs depending on how php is configured.
For example,
<?php
$node = node_load(123);
debug($node);
?>
The full options for debug function are:
debug($data, $label, $print_r);
The $data is pretty self explanatory. It can be anything you could pass through print_r or var_export. The $label allows for a custom label to be added. This is ideal when you are sending the information to a log and you want a key to search the logs for. The 3rd argument is whether to use print_r or var_export. The default is var_export. If you are interested between the two I’d suggest reading the manual pages.
<?php
$node = node_load(123);
print_r($node);
?>
Drupal devel module provides dsm and dpm functions to debug code within drupal.
<?php
$node = node_load(123);
dpm($node);?>
drupal latest version provides debug inbuilt function to print errors, notices and warnings as well.This could be in the page or in the logs depending on how php is configured.
For example,
<?php
$node = node_load(123);
debug($node);
?>
The full options for debug function are:
debug($data, $label, $print_r);
The $data is pretty self explanatory. It can be anything you could pass through print_r or var_export. The $label allows for a custom label to be added. This is ideal when you are sending the information to a log and you want a key to search the logs for. The 3rd argument is whether to use print_r or var_export. The default is var_export. If you are interested between the two I’d suggest reading the manual pages.
0 comments:
Post a Comment