I want to add the machine name of every node into my page.tpl.php template as a class on the body. How can I get that machine name?
I have access to the node object, but I don't see the machine name in there. Is there an api call I can use?
Individual nodes don't have machine names in Drupal 6 or 7, so you can't.
If you want a unique ID for each node, and Node ID won't do (for staging or migration for example), then try taking a look at the UUID module.
This module provides an API for adding universally unique identifiers (UUID) to Drupal objects, most notably entities.
Also of note...
Features in Drupal 6 version
- Automatic UUID generation for nodes, node revisions, users and taxonomy.
- Allow choosing which content types and vocabularies to create UUIDs for.
- Option to batch create UUIDs for objects which don't have it already.
If, however, you want the node TYPE to be available to your template, and you have the node object, it should be under
$node->type, or possibly