summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt3
-rw-r--r--STARTERKIT/css/nodes.css2
-rw-r--r--template.php15
-rw-r--r--templates/node.tpl.php36
4 files changed, 39 insertions, 17 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 9dd8a95..d2a3e17 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -2,6 +2,9 @@
Zen 6.x-2.x-dev, xxxx-xx-xx (development release)
------------------------
+- #547696: Update node.tpl to use ideas from D7
+- Renamed $picture to $user_picture in node.tpl.php
+- Renamed sticky class to node-sticky in node.tpl.php
- Added $build_mode variable to node.tpl.php
- #445814: Change primary/secondary link rendering and move secondary menu to footer
- #445822: Simplify wrapper divs around logo, site name, slogan
diff --git a/STARTERKIT/css/nodes.css b/STARTERKIT/css/nodes.css
index 0919df1..ac1d75f 100644
--- a/STARTERKIT/css/nodes.css
+++ b/STARTERKIT/css/nodes.css
@@ -14,7 +14,7 @@
.node-inner /* Additional wrapper for node */ {
}
-.sticky /* A sticky node (displayed before others in a list) */ {
+.node-sticky /* A sticky node (displayed before others in a list) */ {
}
.node-unpublished /* Unpublished nodes */ {
diff --git a/template.php b/template.php
index 88668be..95fed81 100644
--- a/template.php
+++ b/template.php
@@ -191,10 +191,18 @@ function zen_preprocess_node(&$vars, $hook) {
break;
}
+ // Create the user_picture variable.
+ $vars['user_picture'] = $vars['picture'];
+
// Special classes for nodes.
$classes = array('node');
+ // Class for node type: "node-type-page", "node-type-story", "node-type-my-custom-type", etc.
+ $classes[] = zen_id_safe('node-type-' . $vars['type']);
+ if ($variables['promote']) {
+ $variables['classes_array'][] = 'node-promoted';
+ }
if ($vars['sticky']) {
- $classes[] = 'sticky';
+ $classes[] = 'node-sticky';
}
if (!$vars['status']) {
$classes[] = 'node-unpublished';
@@ -209,8 +217,9 @@ function zen_preprocess_node(&$vars, $hook) {
if ($vars['teaser']) {
$classes[] = 'node-teaser'; // Node is displayed as teaser.
}
- // Class for node type: "node-type-page", "node-type-story", "node-type-my-custom-type", etc.
- $classes[] = zen_id_safe('node-type-' . $vars['type']);
+ if (isset($variables['preview'])) {
+ $variables['classes_array'][] = 'node-preview';
+ }
$vars['classes_array'] = $classes;
$vars['classes'] = implode(' ', $classes); // Concatenate with spaces
}
diff --git a/templates/node.tpl.php b/templates/node.tpl.php
index cb12dc6..3ff2fa3 100644
--- a/templates/node.tpl.php
+++ b/templates/node.tpl.php
@@ -2,24 +2,36 @@
// $Id$
/**
- * @file node.tpl.php
- *
+ * @file
* Theme implementation to display a node.
*
* Available variables:
* - $title: the (sanitized) title of the node.
* - $content: Node body or teaser depending on $teaser flag.
- * - $picture: The authors picture of the node output from
- * theme_user_picture().
+ * - $user_picture: The node author's picture from user-picture.tpl.php.
+ * - $picture: DEPRECATED. This variable has been renamed $user_picture in Drupal 7.
* - $date: Formatted creation date (use $created to reformat with
* format_date()).
* - $links: Themed links like "Read more", "Add new comment", etc. output
* from theme_links().
- * - $name: Themed username of node author output from theme_user().
+ * - $name: Themed username of node author output from theme_username().
* - $node_url: Direct url of the current node.
* - $terms: the themed list of taxonomy term links output from theme_links().
* - $submitted: themed submission information output from
* theme_node_submitted().
+ * - $classes: String of classes that can be used to style contextually through
+ * CSS. It can be manipulated through the variable $classes_array from
+ * preprocess functions. The default values can be one or more of the following:
+ * - node: The current template type, i.e., "theming hook".
+ * - node-[type]: The current node type. For example, if the node is a
+ * "Blog entry" it would result in "node-blog". Note that the machine
+ * name will often be in a short form of the human readable label.
+ * - node-teaser: Nodes in teaser form.
+ * - node-preview: Nodes in preview mode.
+ * The following are controlled through the node publishing options.
+ * - node-promoted: Nodes promoted to the front page.
+ * - node-sticky: Nodes ordered above other non-sticky nodes in teaser listings.
+ * - node-unpublished: Unpublished nodes visible only to administrators.
*
* Other variables:
* - $node: Full node object. Contains data that may not be safe.
@@ -27,6 +39,8 @@
* - $comment_count: Number of comments attached to the node.
* - $uid: User ID of the node author.
* - $created: Time the node was published formatted in Unix timestamp.
+ * - $classes_array: Array of html class attribute values. It is flattened
+ * into a string within the variable $classes.
* - $zebra: Outputs either "even" or "odd". Useful for zebra striping in
* teaser listings.
* - $id: Position of the node. Increments each time it's output.
@@ -51,12 +65,10 @@
?>
<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?>"><div class="node-inner">
- <?php print $picture; ?>
+ <?php print $user_picture; ?>
<?php if (!$page): ?>
- <h2 class="title">
- <a href="<?php print $node_url; ?>" title="<?php print $title ?>"><?php print $title; ?></a>
- </h2>
+ <h2 class="title"><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
<?php endif; ?>
<?php if ($unpublished): ?>
@@ -66,13 +78,11 @@
<?php if ($submitted || $terms): ?>
<div class="meta">
<?php if ($submitted): ?>
- <div class="submitted">
- <?php print $submitted; ?>
- </div>
+ <span class="submitted"><?php print $submitted; ?></span>
<?php endif; ?>
<?php if ($terms): ?>
- <div class="terms terms-inline"><?php print t(' in ') . $terms; ?></div>
+ <div class="terms terms-inline"><?php print $terms; ?></div>
<?php endif; ?>
</div>
<?php endif; ?>