CCK Computed Field: How can I use array contents?

Rosamunda - June 22, 2008 - 05:18

Hi there!
I´m starting to study php, so some day will be able to actually understand how Drupal works and help to make it better.
Right now, I´m struggling with some snippets, and little pieces of code.

I´m using the CCK computed field module and I´m starting to get how it works, (I mean I could make it actually works for me, I´m so exited about that). But I come across a problem: I need the user to be able to create "more fields" of a certain type on the fly, while creating a node.

So I´ve tried Multireference module.
I create a certain multireference field, and fill it with some references.

Using Devel module this is what I get:

field_test_multi_reference

Array
(
    [0] => Array
        (
            [r_id] => 64
            [r_text] => Referenced Node Title 1
            [desc] => 300
            [desc2] =>
        )

    [1] => Array
        (
            [r_id] => 133
            [r_text] => Referenced Node Title 2
            [desc] => this is the node description that user adds on the fly
            [desc2] =>
        )

    [2] => Array
        (
            [r_id] => 139
            [r_text] => Referenced Node Title 3
            [desc] => this is the node description that user adds on the fly
            [desc2] =>
        )

    [3] => Array
        (
            [r_id] => 131
            [r_text] => Referenced Node Title 4
            [desc] => this is the node description that user adds on the fly
            [desc2] =>
        )

)

With this information, and knowing that this array can get far more elements than [3], could I reference them in a computed field?? Do something with them?

Could be another way to do this instead of using multireference module?

I´m starting to understand how array works, and frankly, that´s not an easy task.

Thanks for your guidance!!

Rosamunda

signup

kjpil - April 13, 2009 - 16:24

signup

 
 

Drupal is a registered trademark of Dries Buytaert.