Where is the node object documented?

AnotherHowie - April 1, 2008 - 22:36

I've come to a point in my theme where I want to do things with different taxonomy terms, so I went to look for the documentation on the $node node object available in phptemplate.

I can find how to load a node (in api.drupal.org under load_node). I can find how to theme a node (in the theming guide). I can find a bunch of functions to deal with nodes in various ways (api.drupal.org again). What I can't find is a description of what fields exist inside the node object.

Am I just being dumb? Can someone please point me at a reference page of what there is inside a node object? It seems a pretty fundamental thing, so I'm a little surprised I couldn't find it. I assume it's me.

The node object...

efolia - April 1, 2008 - 23:16

Your frustration is understandable, but the 'content' of the $node object is not fixed. It varies according to your particular Drupal configuration and depends on the modules installed. Many modules modify the $node object substantially. You can always print_r($node) or use the Devel module (www.drupal.org/project/devel) to peek inside the $node objects that you need to look into or manipulate.

Cheers :-)

efolia

Most probably, you have

modul - April 1, 2008 - 23:18

Most probably, you have already dabbled with this:

<?php
echo "<pre>";
var_dump($node);
echo
"</pre>";
?>

Put it in a relevant .tpl file of your theme, and you have the full content, neatly divided, of your node.

Some explanation can be found in the book by VanDyk and Westgate.

Also take a look at: http://drupal.org/node/49768 (although this refers to Drupal 4.7)

 
 

Drupal is a registered trademark of Dries Buytaert.