node_view
Definition
node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE)
modules/node/node.module, line 1031
Description
Generate a display of the given node.
Parameters
$node A node array or node object.
$teaser Whether to display the teaser only or the full form.
$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.
Code
<?php
function node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) {
$node = (object)$node;
$node = node_build_content($node, $teaser, $page);
if ($links) {
$node->links = module_invoke_all('link', 'node', $node, $teaser);
drupal_alter('link', $node->links, $node);
}
// Set the proper node part, then unset unused $node part so that a bad
// theme can not open a security hole.
$content = drupal_render($node->content);
if ($teaser) {
$node->teaser = $content;
unset($node->body);
}
else {
$node->body = $content;
unset($node->teaser);
}
// Allow modules to modify the fully-built node.
node_invoke_nodeapi($node, 'alter', $teaser, $page);
return theme('node', $node, $teaser, $page);
}
?> 