root / drupal7 / sites / all / themes / mayo / templates / node.tpl.php @ bfb52287
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, 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
|
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, i.e. 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, e.g. '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, e.g. $node->body becomes $body. When needing to access
|
71 |
* a field's raw values, developers/themers are strongly encouraged to use these
|
72 |
* variables. Otherwise they will have to explicitly specify the desired field
|
73 |
* language, e.g. $node->body['en'], thus overriding any language negotiation
|
74 |
* 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 $user_picture; ?> |
84 |
|
85 |
<?php print render($title_prefix); ?> |
86 |
<?php if (!$page): ?> |
87 |
<h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2> |
88 |
<?php endif; ?> |
89 |
<?php print render($title_suffix); ?> |
90 |
|
91 |
<?php if ($display_submitted): ?> |
92 |
<div class="submitted"> |
93 |
<?php print $submitted; ?> |
94 |
</div>
|
95 |
<?php endif; ?> |
96 |
|
97 |
<div class="content"<?php print $content_attributes; ?>> |
98 |
<?php
|
99 |
// We hide the comments 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 print render($content['links']); ?> |
107 |
|
108 |
</div>
|
109 |
|
110 |
<?php print render($content['comments']); ?> <!-- added --> |
111 |
|