Reply to comment

jody on February 13, 2008 - 8:44pm

That’s a good question- using fieldgroups makes this even more complex. Here’s an idea showing some fields from a fieldgroup being explicitly displayed, and then anything else in the fieldgroup gets printed last.

<?php
unset($node->content['#children']);
?>

<div class ="details">

<?php
// A regular field
print $node->content['field_a'];
unset(
$node->content['field_a']);
?>

</div>

<div class ="group-special">

<?php
//All fields within a certain fieldgroup
foreach($node->content['group_special'] as $key => $groupfield) {
  if (
$groupfield['#value']) {
    print
$groupfield['#value'];
  }
}
unset(
$node->content['group_special']);
?>

</div>

</div class ="everything-else">

<?php
//All other fields including those in other fieldgroups
foreach($node->content as $key => $field) {
    if (
$field['#value']) { print $field['#value']; }
    else {
      foreach(
$field as $groupfield) {
        if (
$groupfield['#value']) { print $groupfield['#value']; }
      }
    }
  }
?>

</div>

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see and Markdown Extra for tables, footnotes, and more.

More information about formatting options