I'm new in drupal and I'm about to use drupal for my expanding site. This is my issue: I have some documents which segmented to sentences and words and each word has a tag for example:

Document: This is a test text to show what I say. This is the second sentence. This is the third. Sentences: 1. This is a test text to show what I say 2. This is the second sentence and so on.

Tagged words: This => ABC is => DEF a => EE test => NME and so on.

I would like to make a node for each document not each word or sentence and store sentences and words as fields. This data is stored in a mysql database and I can export it in any form. How can I implement this structure in Drupal? Is there any module for it? or I should develop a new module? or any other solution?

Thank you all so much

  • 1
    You'll get a better response if you phrase your question title more specifically. – tog22 Oct 26 '12 at 13:41
  • So you would want "Tagged words" as set of name, value pairs, is it? – Amarnath Ravikumar Dec 26 '12 at 10:40

In case you want to store complete array as a single input in a field, you can do so by serialize the array.

Create a long text field and serialize the array before input by calling hook_node_submit().


Create a new content type (at /admin/structure/types/ in D7). Add the fields you want within it. Then write a template or create a view to output the fields in the order you desire.

  • ok but how can I create an array of words as a field? – Takvaj Oct 26 '12 at 13:17
  • I don't think you can, with the default set of fields. You'd need to search drupal.org for a module which provides an array-like field. – tog22 Oct 26 '12 at 13:41
  • 1
    You can thank by click the up arrow next to my response :) – tog22 Oct 26 '12 at 14:01
  • 1
    You can thank @tog22 even more by clicking the little tick ;-) – Chapabu Oct 26 '12 at 14:50
  • 1
    come on guys :D That Thank you was for replying not for that reply :P – Takvaj Oct 26 '12 at 15:05

Create a text field with multiple possible values and programatically save your datas as $i number values

 $node = new stdClass ();
 $node->type = 'our content type';
 $node->your_field ['und'] [$i] ['value'];

node_save ( $node );

for associative array , field collection module could do

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.