Hello

I have a content type which has a dynamic range of sections, like a news page. Ex

SUBJECT1
indent1Text
indentindent1Text

SUBJECT2
indent2Text
indentindent2Text
...
SUBJECTX
indentXText
indentindentXText

Its easy to create a content type and add a field with cck. I create a field named field_section of widget type Text Area. I set the "Number of values" to unlimited so I can have an unlimited number of sections.

PROBLEM: I do only want one field per section.
So how do find out in my content template which part of the text in the field_section value that is the headline (SUBJECTX), indented once and indented twice.

Hope you see my problem. Making 3 field types (field_headline, field_indent, field_indentindent) would not be very nice since the human page editor would not see them together. Making a group and adding the 3 fields to the group would have solved that problem, but then I can only have one section, since you cannot set group itself to "Number of values" unlimited.

I´d be very thankful for pointers. Please ask if there's something unclear.

Comments

yuriy.babenko’s picture

Ferm, I understand your problem, but don't think there's any easy solution to it.

Do the sections have to be within a single node?

How about doing something like this:

Content type "foo" acts as a container for sections, which are of content type "bar"; the nodehierarchy (http://drupal.org/project/nodehierarchy) module can be used to link the nodes of type "bar" to a parent node of type "foo."

This would allow you to create an unlimited number of sections (nodes of type "bar") and take care of your problem...

---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials

---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com

Ferm-1’s picture

Thanks for your reply.

I started to implement you solution but with a angry face. I started connecting to "bar" types to the "foo" as children. But they were displayed as links instead. I started to look att the views for node hierarchy, but stopped there. It's not a satisfying solution even if I got it to work.

How do others deal with this problem. It such a common thing to have sections like I need.
For example, I checked your cafp site, there's a lot of sections in the preview image, as the "Political Action Commitee" section. You have a image, a head line and a text (such as my three fields). How do you do it? I guees those sections are dynamic also, so there may be 5 of them instead of 6?

yuriy.babenko’s picture

Can't remember how that is setup of CAFP, but I'll try to take a look at it when I get home. That site was actually already built on 4.7 when I came aboard the project - I just helped upgrade it to 5.x, re-theme it, and add a few new features.

---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials

---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com

Ferm-1’s picture

Im a SharePoint 2007 developer. In SharePoint you will do this by saving the fields in a List. The list is a table with (in this case) 3 columns, which the editor can add rows to. When the page is rendered, you go through the list and create a section of each row.
Isnät there anything equvivalent to the SharePont List in Drupal?

RobertPope’s picture

just trying to think - you would then have an array of arrays and you would have to call it differently - would cause templates to stop working as is - i see why that isn't an easy fix - has anyone tried to tackle this one? How are modules built for field types that have mulitple fields? I guess they are able to keep it all in one array. hmmm any ideas?

rpdesigns’s picture

I have a similar problem and even though this is an old thread, Maybe someone has found a solution that I am missing...

Here is a visual of my situation:
http://slyraccoon.dot5hosting.com/files/problem.jpg

I want to have 3 fields in a single group... and keep duplicating that group.
So for the example: I want a group with 3 text fields: "1 description field" - "1 visable field" - "1 hidden field"
This group contains all the needed information for 1 subject, which is a house to rent
now i want to keep adding houses (groups)... in this way i can also re-arrange them.

I suppose this could be done with taxonamy or views and creating a page instead of a group... but i'm really looking for the simpliest way, and im not that familiar with drupal yet to know how to do that.

For now i create a new group and new fields for each house.

thanks.

granticusiv’s picture

For anyone who stumbles across this thread (like me), this module should solve this issue - Field Collection. Only works for D7.