node.tpl.php

  1. 7.x drupal-7.x/modules/node/node.tpl.php
  2. 7.x drupal-7.x/themes/garland/node.tpl.php
  3. 7.x drupal-7.x/themes/bartik/templates/node.tpl.php
  4. 6.x drupal-6.x/modules/node/node.tpl.php
  5. 6.x drupal-6.x/themes/bluemarine/node.tpl.php
  6. 6.x drupal-6.x/themes/pushbutton/node.tpl.php
  7. 6.x drupal-6.x/themes/garland/node.tpl.php

node.tpl.php

Theme implementation to display a node.

Available variables:

  • $title: the (sanitized) title of the node.
  • $content: Node body or teaser depending on $teaser flag.
  • $picture: The authors picture of the node output from theme_user_picture().
  • $date: Formatted creation date (use $created to reformat with format_date()).
  • $links: Themed links like "Read more", "Add new comment", etc. output from theme_links().
  • $name: Themed username of node author output from theme_username().
  • $node_url: Direct URL of the current node.
  • $terms: the themed list of taxonomy term links output from theme_links().
  • $submitted: themed submission information output from theme_node_submitted().

Other variables:

  • $node: Full node object. Contains data that may not be safe.
  • $type: Node type, i.e. story, page, blog, etc.
  • $comment_count: Number of comments attached to the node.
  • $uid: User ID of the node author.
  • $created: Time the node was published formatted in Unix timestamp.
  • $zebra: Outputs either "even" or "odd". Useful for zebra striping in teaser listings.
  • $id: Position of the node. Increments each time it's output.

Node status variables:

  • $teaser: Flag for the teaser state.
  • $page: Flag for the full page state.
  • $promote: Flag for front page promotion state.
  • $sticky: Flags for sticky post setting.
  • $status: Flag for published status.
  • $comment: State of comment settings for the node.
  • $readmore: Flags true if the teaser content of the node cannot hold the main body content.
  • $is_front: Flags true when presented in the front page.
  • $logged_in: Flags true when the current user is a logged-in member.
  • $is_admin: Flags true when the current user is an administrator.

See also

template_preprocess()

template_preprocess_node()

1 theme call to node.tpl.php
node_view in drupal-6.x/modules/node/node.module
Generate a display of the given node.

File

drupal-6.x/modules/node/node.tpl.php
View source
  1. <?php
  2. /**
  3. * @file node.tpl.php
  4. *
  5. * Theme implementation to display a node.
  6. *
  7. * Available variables:
  8. * - $title: the (sanitized) title of the node.
  9. * - $content: Node body or teaser depending on $teaser flag.
  10. * - $picture: The authors picture of the node output from
  11. * theme_user_picture().
  12. * - $date: Formatted creation date (use $created to reformat with
  13. * format_date()).
  14. * - $links: Themed links like "Read more", "Add new comment", etc. output
  15. * from theme_links().
  16. * - $name: Themed username of node author output from theme_username().
  17. * - $node_url: Direct URL of the current node.
  18. * - $terms: the themed list of taxonomy term links output from theme_links().
  19. * - $submitted: themed submission information output from
  20. * theme_node_submitted().
  21. *
  22. * Other variables:
  23. * - $node: Full node object. Contains data that may not be safe.
  24. * - $type: Node type, i.e. story, page, blog, etc.
  25. * - $comment_count: Number of comments attached to the node.
  26. * - $uid: User ID of the node author.
  27. * - $created: Time the node was published formatted in Unix timestamp.
  28. * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in
  29. * teaser listings.
  30. * - $id: Position of the node. Increments each time it's output.
  31. *
  32. * Node status variables:
  33. * - $teaser: Flag for the teaser state.
  34. * - $page: Flag for the full page state.
  35. * - $promote: Flag for front page promotion state.
  36. * - $sticky: Flags for sticky post setting.
  37. * - $status: Flag for published status.
  38. * - $comment: State of comment settings for the node.
  39. * - $readmore: Flags true if the teaser content of the node cannot hold the
  40. * main body content.
  41. * - $is_front: Flags true when presented in the front page.
  42. * - $logged_in: Flags true when the current user is a logged-in member.
  43. * - $is_admin: Flags true when the current user is an administrator.
  44. *
  45. * @see template_preprocess()
  46. * @see template_preprocess_node()
  47. */
  48. ?>
  49. <div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?> clear-block">
  50. <?php print $picture ?>
  51. <?php if (!$page): ?>
  52. <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
  53. <?php endif; ?>
  54. <div class="meta">
  55. <?php if ($submitted): ?>
  56. <span class="submitted"><?php print $submitted ?></span>
  57. <?php endif; ?>
  58. <?php if ($terms): ?>
  59. <div class="terms terms-inline"><?php print $terms ?></div>
  60. <?php endif;?>
  61. </div>
  62. <div class="content">
  63. <?php print $content ?>
  64. </div>
  65. <?php print $links; ?>
  66. </div>