diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 9dd8a95cc61673347b9b616b0ab097ca59fde983..d2a3e17dc17a0778aa88d24946e74f8f1bc7d04d 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 0919df17a5b509c2b5e94e8a3fdb6819325c907a..ac1d75f5a5166c23580a3a8205512fabfc78b915 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 88668bec9cb5a272d4caa0256baffd0cd020c2cb..95fed812e1411d62b31edd9bd65e987eb9d8b176 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 cb12dc6a7de8634e1929ecf74e1a01694f941dd4..3ff2fa3b99d8db6227ca635455e4bdb4e4b44229 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 @@ ?>
- + -

- -

+

@@ -66,13 +78,11 @@
- + -
+