Drupal: Description of $node object
In this article, we will study $node object that is available in node.tpl.php template. When we are done, we can use the object to adjust the node design.
You can view the node content with the standard PHP functions (insert the following code to node.tpl.php file first:
$node has the following variables
- body – the node content
- changed – date of the last changes in Unix-format
- comment – if comments are enabled. Three values are allowed.
- comment_count – the number of comments .
- created – the date of creating in Unix-format (string(10) “1198024338″)
- data – was set to NULL
- files – perhaps, attached files.
- format – number of input format starting from 1.
- last_comment_name – name of the last commentator
- last_comment_timestamp – date when the last comment is left in Unix format.
- log – don’t know what is this, It was empty.
- moderate – moderation flag. Equal null if the node doesn’t require moderation.
- name – name of the author
- nid – number of the node
- path – relative synonym of the path (“content/turpis-premo-inhibeo-abico-luctus”)
- picture – user picture.
- promote – “In the home page”=1, otherwise =0
- revision_timestamp – date of the version in Unix-format
- status – if it is published = 1, otherwise =0
- sticky – over the rest of the nodes =1, otherwise =0
- taxonomy – node parents. I.e. taxonomy parents.
- teaser – the teaser
- title – node title
- type – type of the node
- uid – author’s ID
- vid – version id. Doesn’t always match with nid.
The additional modules can add their variables to the object. These are such modules:
- CCK – every added field will be a set of parameters.
- Nodeteaser – adds $node->nodeteaser, which is TRUE or FALSE, and the teaser is located in $node->teaser.