I am troubleshooting a module and want to display the values of variables. Where to I put print_r(), var_dump, and those types of commands to make them display? In a node template? Is there a snippet or something?

mrweaver

Comments

WorldFallz’s picture

It all depends on what exactly you're trouble shooting-- you need to put it near the code you're trying to debug.

nevets’s picture

You put in the code where you want to trouble shoot the values.

In theme functions/templates I use print '<pre>' . print_r($variable, TRUE) . '</pre>'

In other code I use drupal_set_message('<pre>' . print_r($variable, TRUE) . '</pre>')

If you install the devel module you can use kpr($variable)

mattrweaver’s picture

Thanks, nevets. That's just what I needed

Finished products are for decadent minds. -- Isaac Asimov