root / drupal7 / themes / bartik / templates / node.tpl.php @ master
1 | 85ad3d82 | Assos Assos | <?php
|
---|---|---|---|
2 | |||
3 | /**
|
||
4 | * @file
|
||
5 | * Bartik's 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 | ?>
|
||
81 | <div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>> |
||
82 | |||
83 | <?php print render($title_prefix); ?> |
||
84 | <?php if (!$page): ?> |
||
85 | <h2<?php print $title_attributes; ?>> |
||
86 | <a href="<?php print $node_url; ?>"><?php print $title; ?></a> |
||
87 | </h2>
|
||
88 | <?php endif; ?> |
||
89 | <?php print render($title_suffix); ?> |
||
90 | |||
91 | <?php if ($display_submitted): ?> |
||
92 | <div class="meta submitted"> |
||
93 | <?php print $user_picture; ?> |
||
94 | <?php print $submitted; ?> |
||
95 | </div>
|
||
96 | <?php endif; ?> |
||
97 | |||
98 | <div class="content clearfix"<?php print $content_attributes; ?>> |
||
99 | <?php
|
||
100 | // We hide the comments and links now so that we can render them later.
|
||
101 | hide($content['comments']); |
||
102 | hide($content['links']); |
||
103 | print render($content); |
||
104 | ?>
|
||
105 | </div>
|
||
106 | |||
107 | <?php
|
||
108 | // Remove the "Add new comment" link on the teaser page or if the comment
|
||
109 | // form is being displayed on the same page.
|
||
110 | if ($teaser || !empty($content['comments']['comment_form'])) { |
||
111 | unset($content['links']['comment']['#links']['comment-add']); |
||
112 | } |
||
113 | // Only display the wrapper div if there are links.
|
||
114 | $links = render($content['links']); |
||
115 | if ($links): |
||
116 | ?>
|
||
117 | <div class="link-wrapper"> |
||
118 | <?php print $links; ?> |
||
119 | </div>
|
||
120 | <?php endif; ?> |
||
121 | |||
122 | <?php print render($content['comments']); ?> |
||
123 | |||
124 | </div> |