| Versions | |
|---|---|
| 4.7 – 5 | theme_node( |
| 6 | theme_node() |
| 7 | theme_node($variables) |
Return a themed node.
$node An object providing all relevant information for displaying a node:
$teaser Whether to display the teaser only, as on the main page.
$page Whether to display the node as a standalone page. If TRUE, do not display the title because it will be provided by the menu system.
A string containing the node output.
includes/
<?php
function theme_node($node, $teaser = FALSE, $page = FALSE) {
if (!$node->status) {
$output = '<div class="node-unpublished">';
}
if (module_exists('taxonomy')) {
$terms = taxonomy_link('taxonomy terms', $node);
}
if ($page == 0) {
$output .= t('!title by !name', array('!title' => '<h2 class="title">' . check_plain($node->title) . '</h2>', '!name' => theme('username', $node)));
}
else {
$output .= t('by !name', array('!name' => theme('username', $node)));
}
if (count($terms)) {
$output .= ' <small>(' . theme('links', $terms) . ')</small><br />';
}
if ($teaser && $node->teaser) {
$output .= $node->teaser;
}
else {
$output .= $node->body;
}
if ($node->links) {
$output .= '<div class="links">' . theme('links', $node->links) . '</div>';
}
if (!$node->status) {
$output .= '</div>';
}
return $output;
}
?>