Hi,

Newbie question, I'm trying to use DSM to identify specific elements in a node to control the way the content is printed to the page. I have the developer module installed and activated.

I add dsm($node); to the relevant page however nothing appears? Any ideas what I'm doing wrong.

Cheers

G

Comments

josepvalls’s picture

I understand that you are adding this code in your page.tpl.php, but there, the messages and so are already built, so won't work. You may try

print var_export($node,true);

You probably want to use dpm($node) instead, but if you have devel activated, you can just use the devel load tab on the node and will print out dpm($node).

SB’s picture

Check if you have the messages box in your active theme!

The dsm() function prints any variable directly into the drupal $messages box on your page. What's a $messages box? It's that specially-colored area in your theme that Drupal uses to announce cool happenings such as "Created new taxonomy term for node/4312". Arrays printed with this function during module development are far less likely to wreck your beautiful page layout, and it also allows you to more easily see the content of your nodes during development, when contrasted with the dprint_r() function above.

http://drupal.org/node/174575

yash_khandelwal’s picture

dsm(), dpm() functions are still there in drupal 8 but they won’t print the variable using Krumo as it has been removed from Devel in Drupal 8. For that you can use kint().

Kint ships as a sub-module in Devel and the library itself is also in the sub-module. So all you need to do is download devel and enable kint.

kint() ->The kint function prints everything at the top of the page.
ksm() -> The ksm function prints the Kint output in the message region of your theme.

Yash Khandelwal
Drupal Developer