Is there a way to output group of fields with all fileds it contains in node.tpl.php?

The closest solution that I found is


foreach($node->content['group_mygroup'] as $key => $groupfield) {
  if ($groupfield['#value']) {
    print $groupfield['#value'];
  }
}

Taken from here http://drupal.org/node/253211 but doesnt work for me at all.

Any ideas how to do that?

Comments

volocuga’s picture

I found the solution :

print $group_groupname_rendered;

Pretty easy :)

volocuga’s picture

Status: Active » Closed (fixed)
xalexas’s picture

You can print all fieldsets with little php for specific content type (in my case story):

Put this in your node.tpl.php (or where you want)

	
	$query = db_query("SELECT group_name FROM {content_group} WHERE type_name='story' ORDER BY weight");
	
	while ($row = db_fetch_array($query)) {
        print ${$row[group_name]."_rendered"};
}

Maybe there is a better way but I haven't found it.

andrea.cavattoni’s picture

How can i doit in d7?