Index: content.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/content.module,v
retrieving revision 1.301.2.70
diff -u -r1.301.2.70 content.module
--- content.module	9 Oct 2008 00:24:49 -0000	1.301.2.70
+++ content.module	9 Oct 2008 19:11:18 -0000
@@ -200,6 +200,9 @@
       'path' => $path,
       'arguments' => array('form' => NULL),
     ),
+    'content_content' => array(
+      'arguments' => array('content' => NULL, 'object' => array(), 'context' => NULL),
+    ),
     'content_view_multiple_field' => array(
       'arguments' => array('items' => NULL, 'field' => NULL, 'data' => NULL),
     ),
@@ -738,11 +741,16 @@
         }
 
         // The wrapper lets us get the themed output for the whole field
-        // once the $node->content has been rendered.
-        // See op 'preprocess_node' below.
+        // to populate the $FIELD_NAME_rendered variable for node templates,
+        // and hide it from the $content variable if needed.
+        // See 'preprocess_node' op and theme_content_field_wrapper()?
         $wrapper = array(
           'field' => $element,
           '#weight' => $field['widget']['weight'],
+          '#post_render' => array('content_field_wrapper_post_render'),
+          '#field_name' => $field['field_name'],
+          '#type_name' => $node->type,
+          '#context' => $context,
         );
 
         $addition = array($field['field_name'] => $wrapper);
@@ -2024,6 +2032,58 @@
   return (array) $default_value;
 }
 
+ /**
+ * Hide specified fields from the $content variable in node templates.
+ */
+function content_field_wrapper_post_render($content, $element) {
+  $fields = content_fields();
+  $field = $fields[$element['#field_name']];
+  return theme('content_content', $content, $field, $element['#context']);
+}
+
+
+/**
+ * 'Theme' function for a field's addition to $content.
+ *
+ * Adapts the all-inclusive $content variable in node templates to allow
+ * some field content to be excluded.
+ * 
+ * The html for individual fields and groups are available in the 
+ * $FIELD_NAME_rendered and $GROUP_NAME_rendered variables.
+ * 
+ * This allows more flexibility in node templates : you can use custom markup
+ * around a few specific fields, and print the rest of the node with $content.
+ *
+ * @param $content
+ *    The themed content for this field.
+ * 
+ * @param $object
+ *    The field or group array for this item.
+ *
+ * @param $context
+ *    The context for which the node is being rendered.
+ *    Can be one of the following values :
+ *    - 'teaser'
+ *    - 'full'
+ *    - NODE_BUILD_SEARCH_INDEX
+ *    - NODE_BUILD_SEARCH_RESULT
+ *    - NODE_BUILD_RSS
+ *    - NODE_BUILD_PRINT
+ *
+ * @return
+ *   The content to be added to $content in this context.
+ *   Uses the value of the 'Exclude' checkbox for this field
+ *   as set on the Manage fields screen.
+ */
+function theme_content_content($content, $object, $context) {
+  if (!is_array($object['display_settings'][$context]) || empty($object['display_settings'][$context]['exclude'])) {
+    return $content;
+  }
+  else {
+    return '';
+  }
+}
+
 /**
  * Theme preprocess function for field.tpl.php.
  *
@@ -2307,4 +2367,4 @@
     return $inactive[$type_name];
   }
   return $inactive;
-}
\ No newline at end of file
+}
Index: includes/content.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/includes/content.admin.inc,v
retrieving revision 1.181.2.50
diff -u -r1.181.2.50 content.admin.inc
--- includes/content.admin.inc	8 Oct 2008 20:01:25 -0000	1.181.2.50
+++ includes/content.admin.inc	9 Oct 2008 19:13:06 -0000
@@ -551,7 +551,7 @@
     $group_options = _fieldgroup_groups_label($type['type']);
   }
   $contexts = content_build_modes($contexts_selector);
-
+  
   $form = array(
     '#tree' => TRUE,
     '#type_name' => $type['type'],
@@ -599,12 +599,19 @@
       $options[$formatter_name] = $formatter_info['label'];
     }
     $options['hidden'] = t('<Hidden>');
+    
     foreach ($contexts as $key => $value) {
       $form[$name][$key]['format'] = array(
         '#type' => 'select',
         '#options' => $options,
         '#default_value' => isset($defaults[$key]['format']) ? $defaults[$key]['format'] : 'default',
       );
+      // exclude from $content
+      $form[$name][$key]['exclude'] = array(
+        '#type' => 'checkbox',
+        '#options' => array(0 => t('Include'), 1 => t('Exclude')),
+        '#default_value' => isset($defaults[$key]['exclude']) ? $defaults[$key]['exclude'] : 0,
+      );
     }
   }
 
@@ -640,7 +647,13 @@
       $form[$name][$key]['format'] = array(
         '#type' => 'select',
         '#options' => $options,
-        '#default_value' => isset($defaults[$key]) ? $defaults[$key] : 'fieldset',
+        '#default_value' => isset($defaults[$key]['format']) ? $defaults[$key]['format'] : 'fieldset',
+      );
+      // exclude in $content
+      $form[$name][$key]['exclude'] = array(
+        '#type' => 'checkbox',
+        '#options' => array(0 => t('Include'), 1 => t('Exclude')),
+        '#default_value' => isset($defaults[$key]['exclude']) ? $defaults[$key]['exclude'] : 0,
       );
     }
     foreach ($group['fields'] as $field_name => $field) {
@@ -1120,7 +1133,7 @@
   if (is_array($additions)) {
     $form['field'] = array_merge($form['field'], $additions);
   }
-
+  
   $form['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Save field settings'),
Index: modules/fieldgroup/fieldgroup.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/modules/fieldgroup/fieldgroup.module,v
retrieving revision 1.79.2.34
diff -u -r1.79.2.34 fieldgroup.module
--- modules/fieldgroup/fieldgroup.module	6 Oct 2008 15:11:39 -0000	1.79.2.34
+++ modules/fieldgroup/fieldgroup.module	9 Oct 2008 19:11:28 -0000
@@ -573,12 +573,17 @@
           }
         }
 
-        // The wrapper lets us get the themed output for the whole group
-        // once the $node->content has been rendered.
-        // See fieldgroup_preprocess_node().
+        // The wrapper lets us get the themed output for the group
+        // to populate the $GROUP_NAME_rendered variable for node templates,
+        // and hide it from the $content variable if needed.
+        // See fieldgroup_preprocess_node(), theme_fieldgroup_wrapper().
         $wrapper = array(
           'group' => $element,
           '#weight' => $group['weight'],
+          '#post_render' => array('fieldgroup_wrapper_post_render'),
+          '#group_name' => $group_name,
+          '#type_name' => $node->type,
+          '#context' => $context,
         );
 
         $node->content[$group_name] = $wrapper;
@@ -587,6 +592,19 @@
   }
 }
 
+/**
+ * Hide specified fields from the $content variable in node templates.
+ */
+function fieldgroup_wrapper_post_render($content, $element) {
+  $groups = fieldgroup_groups($element['#type_name']);
+  $group = $groups[$element['#group_name']];
+  
+  // The display settings are not in quite the same place in the
+  // group and the field, so create the value the theme will expect.
+  $group['display_settings'] = $group['settings']['display'];
+  return theme('content_content', $content, $group, $element['#context']);
+}
+
 /*
  * Get the group name for a field.
  * If the field isn't in a group, FALSE will be returned.
Index: theme/content-admin-display-overview-form.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/theme/Attic/content-admin-display-overview-form.tpl.php,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 content-admin-display-overview-form.tpl.php
--- theme/content-admin-display-overview-form.tpl.php	23 Sep 2008 17:32:31 -0000	1.1.2.2
+++ theme/content-admin-display-overview-form.tpl.php	9 Oct 2008 17:59:12 -0000
@@ -14,6 +14,7 @@
         <?php endif; ?>
         <?php foreach ($contexts as $key => $value): ?>
           <th><?php print $value['title']; ?></th>
+          <th><?php print t('Exclude'); ?></th>
         <?php endforeach; ?>
       </tr>
     </thead>
@@ -27,7 +28,8 @@
             <td><?php print $row->label; ?></td>
           <?php endif; ?>
           <?php foreach ($contexts as $context => $title): ?>
-            <td><?php print $row->{$context}; ?></td>
+            <td><?php print $row->{$context}->format; ?></td>
+            <td><?php print $row->{$context}->exclude; ?></td>
           <?php endforeach; ?>
         </tr>
         <?php $count++;
Index: theme/theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/theme/Attic/theme.inc,v
retrieving revision 1.1.2.8
diff -u -r1.1.2.8 theme.inc
--- theme/theme.inc	6 Oct 2008 15:11:39 -0000	1.1.2.8
+++ theme/theme.inc	9 Oct 2008 19:09:40 -0000
@@ -148,6 +148,7 @@
   else {
     $help = t("Configure how this content type's fields should be displayed when it's rendered in the following contexts.");
   }
+  $help .= ' '. t("Use the 'Exclude' checkbox to exclude an item from the !content variable passed to the node template.", array('!content' => '$content'));
   $vars['help'] = $help;
 
   if (empty($order)) {
@@ -164,7 +165,13 @@
     $element = &$form[$key];
     $row = new stdClass();
     foreach (element_children($element) as $child) {
-      $row->{$child} = drupal_render($element[$child]);
+      if (!array_key_exists('exclude', $element[$child])) {
+        $row->{$child} = drupal_render($element[$child]);
+      }
+      else {
+        $row->{$child}->format = drupal_render($element[$child]['format']);
+        $row->{$child}->exclude = drupal_render($element[$child]['exclude']);
+      }
     }
     $row->label_class = in_array($key, $form['#groups']) ? 'label-group' : 'label-field';
     $row->indentation = theme('indentation', isset($element['#depth']) ? $element['#depth'] : 0);
@@ -172,5 +179,4 @@
   }
   $vars['rows'] = $rows;
   $vars['submit'] = drupal_render($form);
-}
-
+}
\ No newline at end of file

