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