| 1 |
<?php
|
| 2 |
// $Id: node.tpl.php,v 1.27 2009/10/19 18:28:15 dries Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Default theme implementation to display a node.
|
| 7 |
*
|
| 8 |
* Available variables:
|
| 9 |
* - $title: the (sanitized) title of the node.
|
| 10 |
* - $content: An array of node items. Use render($content) to print them all, or
|
| 11 |
* print a subset such as render($content['field_example']). Use
|
| 12 |
* hide($content['field_example']) to temporarily suppress the printing of a
|
| 13 |
* given element.
|
| 14 |
* - $user_picture: The node author's picture from user-picture.tpl.php.
|
| 15 |
* - $date: Formatted creation date. Preprocess functions can reformat it by
|
| 16 |
* calling format_date() with the desired parameters on the $created variable.
|
| 17 |
* - $name: Themed username of node author output from theme_username().
|
| 18 |
* - $node_url: Direct url of the current node.
|
| 19 |
* - $terms: the themed list of taxonomy term links output from theme_links().
|
| 20 |
* - $display_submitted: whether submission information should be displayed.
|
| 21 |
* - $contextual_links (array): An array of contextual links for the node.
|
| 22 |
* - $classes: String of classes that can be used to style contextually through
|
| 23 |
* CSS. It can be manipulated through the variable $classes_array from
|
| 24 |
* preprocess functions. The default values can be one or more of the following:
|
| 25 |
* - node: The current template type, i.e., "theming hook".
|
| 26 |
* - node-[type]: The current node type. For example, if the node is a
|
| 27 |
* "Blog entry" it would result in "node-blog". Note that the machine
|
| 28 |
* name will often be in a short form of the human readable label.
|
| 29 |
* - node-teaser: Nodes in teaser form.
|
| 30 |
* - node-preview: Nodes in preview mode.
|
| 31 |
* The following are controlled through the node publishing options.
|
| 32 |
* - node-promoted: Nodes promoted to the front page.
|
| 33 |
* - node-sticky: Nodes ordered above other non-sticky nodes in teaser listings.
|
| 34 |
* - node-unpublished: Unpublished nodes visible only to administrators.
|
| 35 |
*
|
| 36 |
* Other variables:
|
| 37 |
* - $node: Full node object. Contains data that may not be safe.
|
| 38 |
* - $type: Node type, i.e. story, page, blog, etc.
|
| 39 |
* - $comment_count: Number of comments attached to the node.
|
| 40 |
* - $uid: User ID of the node author.
|
| 41 |
* - $created: Time the node was published formatted in Unix timestamp.
|
| 42 |
* - $classes_array: Array of html class attribute values. It is flattened
|
| 43 |
* into a string within the variable $classes.
|
| 44 |
* - $zebra: Outputs either "even" or "odd". Useful for zebra striping in
|
| 45 |
* teaser listings.
|
| 46 |
* - $id: Position of the node. Increments each time it's output.
|
| 47 |
*
|
| 48 |
* Node status variables:
|
| 49 |
* - $build_mode: Build mode, e.g. 'full', 'teaser'...
|
| 50 |
* - $teaser: Flag for the teaser state (shortcut for $build_mode == 'teaser').
|
| 51 |
* - $page: Flag for the full page state.
|
| 52 |
* - $promote: Flag for front page promotion state.
|
| 53 |
* - $sticky: Flags for sticky post setting.
|
| 54 |
* - $status: Flag for published status.
|
| 55 |
* - $comment: State of comment settings for the node.
|
| 56 |
* - $readmore: Flags true if the teaser content of the node cannot hold the
|
| 57 |
* main body content.
|
| 58 |
* - $is_front: Flags true when presented in the front page.
|
| 59 |
* - $logged_in: Flags true when the current user is a logged-in member.
|
| 60 |
* - $is_admin: Flags true when the current user is an administrator.
|
| 61 |
*
|
| 62 |
* Field variables: for each field instance attached to the node a corresponding
|
| 63 |
* variable is defined, e.g. $node->body becomes $body. When needing to access
|
| 64 |
* a field's raw values, developers/themers are strongly encouraged to use these
|
| 65 |
* variables. Otherwise they will have to explicitly specify the desired field
|
| 66 |
* language, e.g. $node->body['en'], thus overriding any language negotiation
|
| 67 |
* rule that was previously applied.
|
| 68 |
*
|
| 69 |
* @see template_preprocess()
|
| 70 |
* @see template_preprocess_node()
|
| 71 |
* @see template_process()
|
| 72 |
*/
|
| 73 |
?>
|
| 74 |
<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
|
| 75 |
|
| 76 |
<?php print $user_picture; ?>
|
| 77 |
|
| 78 |
<?php if (!$page && $contextual_links): ?>
|
| 79 |
<?php print render($contextual_links); ?>
|
| 80 |
<?php endif; ?>
|
| 81 |
|
| 82 |
<?php if (!$page): ?>
|
| 83 |
<h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $node_title; ?></a></h2>
|
| 84 |
<?php endif; ?>
|
| 85 |
|
| 86 |
<?php if ($display_submitted || !empty($content['links']['terms'])): ?>
|
| 87 |
<div class="meta">
|
| 88 |
<?php if ($display_submitted): ?>
|
| 89 |
<span class="submitted">
|
| 90 |
<?php
|
| 91 |
print t('Submitted by !username on !datetime',
|
| 92 |
array('!username' => $name, '!datetime' => $date));
|
| 93 |
?>
|
| 94 |
</span>
|
| 95 |
<?php endif; ?>
|
| 96 |
|
| 97 |
<?php if (!empty($content['links']['terms'])): ?>
|
| 98 |
<div class="terms terms-inline"><?php print render($content['links']['terms']); ?></div>
|
| 99 |
<?php endif; ?>
|
| 100 |
</div>
|
| 101 |
<?php endif; ?>
|
| 102 |
|
| 103 |
<div class="content"<?php print $content_attributes; ?>>
|
| 104 |
<?php
|
| 105 |
// We hide the comments and links now so that we can render them later.
|
| 106 |
hide($content['comments']);
|
| 107 |
hide($content['links']);
|
| 108 |
print render($content);
|
| 109 |
?>
|
| 110 |
</div>
|
| 111 |
|
| 112 |
<?php print render($content['links']); ?>
|
| 113 |
|
| 114 |
<?php print render($content['comments']); ?>
|
| 115 |
|
| 116 |
</div>
|