I am using a cck group (appears as "Standard group" under "type" in the form definition for "manage fields") to group together some cck fields in a node. I want to know if there is a way to theme this group.

I know that we can theme the individual fields as described in http://drupal.org/node/269319#comment-911336. But is there a way to theme the cck group? Is using something like content-field-[GROUP_NAME].tpl.php supposed to work? (It does not work for me right now but I do not know if it is a problem at my end).

If this does not work, is it possible to include this feature in future releases?

Here is a scenario where it can be very useful: I would alter the display of each of the fields based on the collective information in the fields.

Any thoughts?

Thanks
iyer

Comments

ilakshmir’s picture

Status: Active » Closed (fixed)

Oops! I got the answer: I should use:

fieldgroup-simple-[groupname].tpl.php

shuhaidianzi’s picture

Sounds good. I also encountered this problem. But how do you do with the template.php? Do you need to add a function like template_group() to pass the parameter to the template file?

Funkwarrior’s picture

fieldgroup-simple-[groupname].tpl.php not working for me... :( I need to add the original fieldgroup-simple.tpl.php in my theme folder I suppose....

Funkwarrior’s picture

Yes... :)

_snake_’s picture

Status: Closed (fixed) » Active

Hi,

I don't know if that post should be here, but I need the following:

I have some group fields in a content type, and I need to put some fields from each group field in the same line.

I'm trying to do that following that example: http://drupal.org/node/601646 but it doesn't work

So, my field group is called "group_header_invoice" and I created the fieldgroup-simple-[group_header_invoice].tpl.php and the fieldgroup-simple.tpl.php (from this module).

Even using fieldgroup-simple-group_header_invoice.tpl.php the group field doesn't work. I put all this files in my theme folder.

my question is: what code I need to put in the fieldgroup-simple-group_header_invoice.tpl.php? Or, Do I have to put the code inside the fieldgroup-simple.tpl.php?

I think I need to add a reference or similar in the template.php file, isn't it?

Thanks

_snake_’s picture

Well,

the best solution (at the moment) is do it using CSS.

info@cgfix.com’s picture

template files (sample.tpl.php) are always found in the module folder of what you are themeing but I also can not get this to work. I have copied "fieldgroup-simple.tpl.php" to my theme folder also copied it and renamed the copy to "fieldgroup-simple-[group-machine-name].tpl.php" with no success with either file.

So my theme folder contains:
fieldgroup-simple.tpl.php
fieldgroup-simple-group_blnc.tpl.php

But the files have no effect.

Any suggestions

manxian’s picture

If it helps, I had the same issue until I read:
http://creativecss.co.uk/blog/cck-fieldgroups-drupal6

The key was to go into the Display Fields area of the content type admin at
admin/content/node-type/[your-type]/display
and set the display to 'simple' in the dropdown box alongside the group heading for teaser and/or full node display as you require.

Without doing this the default is 'fieldset' which does not use the 'fieldgroup-simple' template, preprocess functions etc.

For me - this issue could be marked as closed.