node_view

Versions
4.6 – 6
node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE)

Generate a display of the given node.

Parameters

$node A node array or node object.

$teaser Whether to display only the teaser for the node.

$page Whether the node is being displayed by itself as a page.

$links Whether or not to display node links. Links are omitted for node previews.

Return value

An HTML representation of the themed node.

▾ 10 functions call node_view()

archive_page in modules/archive.module
Menu callback; lists all nodes posted on a given date.
blog_page_last in modules/blog.module
Displays a Drupal page containing recent blog entries of all users.
blog_page_user in modules/blog.module
Displays a Drupal page containing recent blog entries of a given user.
comment_preview in modules/comment.module
comment_reply in modules/comment.module
node_page_default in modules/node.module
Generate a listing of promoted nodes.
node_show in modules/node.module
Generate a page displaying a single node, along with its comments.
queue_view in modules/queue.module
Display a queued node along with voting options for it.
taxonomy_render_nodes in modules/taxonomy.module
Accepts the result of a pager_query() call, such as that performed by taxonomy_select_nodes(), and formats each node along with a pager.
theme_node_preview in modules/node.module
Display a node preview for display during node creation and editing.

Code

modules/node.module, line 481

<?php
function node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) {
  $node = array2object($node);

  // Remove the delimiter (if any) that separates the teaser from the body.
  // TODO: this strips legitimate uses of '<!--break-->' also.
  $node->body = str_replace('<!--break-->', '', $node->body);

  // The 'view' hook can be implemented to overwrite the default function
  // to display nodes.
  if (node_hook($node, 'view')) {
    node_invoke($node, 'view', $teaser, $page);
  }
  else {
    $node = node_prepare($node, $teaser);
  }
  // Allow modules to change $node->body before viewing.
  node_invoke_nodeapi($node, 'view', $teaser, $page);
  if ($links) {
    $node->links = module_invoke_all('link', 'node', $node, !$page);
  }
  // unset unused $node part so that a bad theme can not open a security hole
  if ($teaser) {
    unset($node->body);
  }
  else {
    unset($node->teaser);
  }

  return theme('node', $node, $teaser, $page);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.