cms/drupal/modules/node/node.tpl.php
changeset 541 e756a8c72c3d
equal deleted inserted replaced
540:07239de796bb 541:e756a8c72c3d
       
     1 <?php
       
     2 
       
     3 /**
       
     4  * @file
       
     5  * Default theme implementation to display a node.
       
     6  *
       
     7  * Available variables:
       
     8  * - $title: the (sanitized) title of the node.
       
     9  * - $content: An array of node items. Use render($content) to print them all,
       
    10  *   or print a subset such as render($content['field_example']). Use
       
    11  *   hide($content['field_example']) to temporarily suppress the printing of a
       
    12  *   given element.
       
    13  * - $user_picture: The node author's picture from user-picture.tpl.php.
       
    14  * - $date: Formatted creation date. Preprocess functions can reformat it by
       
    15  *   calling format_date() with the desired parameters on the $created variable.
       
    16  * - $name: Themed username of node author output from theme_username().
       
    17  * - $node_url: Direct URL of the current node.
       
    18  * - $display_submitted: Whether submission information should be displayed.
       
    19  * - $submitted: Submission information created from $name and $date during
       
    20  *   template_preprocess_node().
       
    21  * - $classes: String of classes that can be used to style contextually through
       
    22  *   CSS. It can be manipulated through the variable $classes_array from
       
    23  *   preprocess functions. The default values can be one or more of the
       
    24  *   following:
       
    25  *   - node: The current template type; for example, "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
       
    34  *     listings.
       
    35  *   - node-unpublished: Unpublished nodes visible only to administrators.
       
    36  * - $title_prefix (array): An array containing additional output populated by
       
    37  *   modules, intended to be displayed in front of the main title tag that
       
    38  *   appears in the template.
       
    39  * - $title_suffix (array): An array containing additional output populated by
       
    40  *   modules, intended to be displayed after the main title tag that appears in
       
    41  *   the template.
       
    42  *
       
    43  * Other variables:
       
    44  * - $node: Full node object. Contains data that may not be safe.
       
    45  * - $type: Node type; for example, story, page, blog, etc.
       
    46  * - $comment_count: Number of comments attached to the node.
       
    47  * - $uid: User ID of the node author.
       
    48  * - $created: Time the node was published formatted in Unix timestamp.
       
    49  * - $classes_array: Array of html class attribute values. It is flattened
       
    50  *   into a string within the variable $classes.
       
    51  * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in
       
    52  *   teaser listings.
       
    53  * - $id: Position of the node. Increments each time it's output.
       
    54  *
       
    55  * Node status variables:
       
    56  * - $view_mode: View mode; for example, "full", "teaser".
       
    57  * - $teaser: Flag for the teaser state (shortcut for $view_mode == 'teaser').
       
    58  * - $page: Flag for the full page state.
       
    59  * - $promote: Flag for front page promotion state.
       
    60  * - $sticky: Flags for sticky post setting.
       
    61  * - $status: Flag for published status.
       
    62  * - $comment: State of comment settings for the node.
       
    63  * - $readmore: Flags true if the teaser content of the node cannot hold the
       
    64  *   main body content.
       
    65  * - $is_front: Flags true when presented in the front page.
       
    66  * - $logged_in: Flags true when the current user is a logged-in member.
       
    67  * - $is_admin: Flags true when the current user is an administrator.
       
    68  *
       
    69  * Field variables: for each field instance attached to the node a corresponding
       
    70  * variable is defined; for example, $node->body becomes $body. When needing to
       
    71  * access a field's raw values, developers/themers are strongly encouraged to
       
    72  * use these variables. Otherwise they will have to explicitly specify the
       
    73  * desired field language; for example, $node->body['en'], thus overriding any
       
    74  * language negotiation rule that was previously applied.
       
    75  *
       
    76  * @see template_preprocess()
       
    77  * @see template_preprocess_node()
       
    78  * @see template_process()
       
    79  *
       
    80  * @ingroup themeable
       
    81  */
       
    82 ?>
       
    83 <div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
       
    84 
       
    85   <?php print $user_picture; ?>
       
    86 
       
    87   <?php print render($title_prefix); ?>
       
    88   <?php if (!$page): ?>
       
    89     <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
       
    90   <?php endif; ?>
       
    91   <?php print render($title_suffix); ?>
       
    92 
       
    93   <?php if ($display_submitted): ?>
       
    94     <div class="submitted">
       
    95       <?php print $submitted; ?>
       
    96     </div>
       
    97   <?php endif; ?>
       
    98 
       
    99   <div class="content"<?php print $content_attributes; ?>>
       
   100     <?php
       
   101       // We hide the comments and links now so that we can render them later.
       
   102       hide($content['comments']);
       
   103       hide($content['links']);
       
   104       print render($content);
       
   105     ?>
       
   106   </div>
       
   107 
       
   108   <?php print render($content['links']); ?>
       
   109 
       
   110   <?php print render($content['comments']); ?>
       
   111 
       
   112 </div>