Index: content.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/content.module,v
retrieving revision 1.55
diff -u -r1.55 content.module
--- content.module	24 Apr 2006 13:01:03 -0000	1.55
+++ content.module	27 Apr 2006 22:36:47 -0000
@@ -303,12 +303,40 @@
  * Implementation of hook_view().
  */
 function content_view(&$node, $teaser = FALSE, $page = FALSE) {
-  $node->body = implode('', _content_field_invoke('view', $node, FALSE, $page));
-  $node->teaser = implode('', _content_field_invoke('view', $node, TRUE, $page));
+  // invoke content_field_invoke to grab view info from fields
+  _content_field_invoke('view', $node, FALSE, $page);
+  
+  // create an array of the results, sorted by weight, then label
+  foreach ($node as $field_name => $data) {
+    if (substr($field_name, 0, 5) == 'field') {
+       foreach ($data as $delta => $value) {
+         $out[$value['weight']][$value['label'] .'_'. $delta] = array(
+           'label' => $value['label'], 'value' => $value['view'], 'field_name' => $field_name);
+       }
+    }
+  }
+  // pass resulting array to the theme
+  $node->body     = theme('content_view', $out);
+  $node->teaser   = node_teaser($node->body);
   $node->readmore = ($node->body != $node->teaser);
 }
 
 /**
+ *  A basic theme for the output, can be overridden in page themes
+ */
+function theme_content_view($out) {
+  $output = '<dl>';
+  foreach ($out as $weight => $delta) {
+    foreach ($delta as $field => $values) {
+       $output .= '<dt class="'. $values['field_name'] .'">'. $values['label'] .':</dt>';
+       $output .= '<dd class="'. $values['field_name'] .'">'. $values['value'] .'</dd>';
+    }
+  }
+  $output .= '</dl>';
+  return $output;
+}
+
+/**
  * Implementation of hook_field(). Handles common field housekeeping.
  *
  * This implementation is special, as content.module does not define any field
@@ -440,6 +468,15 @@
       // Delete using nid rather than vid to purge all revisions.
       db_query('DELETE FROM {'. $db_info['table'] .'} WHERE nid = %d', $node->nid);
       return;
+
+    case 'view':
+      // allow content module to add label and weight elements to $node_field
+      // view value should have already been created by the individual field modules
+      foreach ($node_field as $delta => $item) {
+        $node_field[$delta]['weight'] = $field['widget']['weight'];
+        $node_field[$delta]['label']  = $field['widget']['label'];
+      }
+      return;
   }
 }
 
@@ -487,7 +524,6 @@
       $node->$field['field_name'] = $node_field;
     }
   }
-
   return $return;
 }
 
