I'm trying to display the following info (per example):

[field_shirt_code] => Array
        (
            [0] => Array
                (
                    [value] => MC1
                    [view] => MC1
                )

        )

What I want to display in the node is:
Field Code: MC1

But I can't for the life of me get the MC1 to display. All I get is "array".

I'm not a PHP programmer. The logical code for me is:

print $field_shirt_code['0']['value']

But this obviously(?) does not work.

Any ideas?

Comments

MPiccinato’s picture

try removing the quotations around the 0

print $field_shirt_code[0]['value']

http://www.mpiccinato.net

FranCarstens’s picture

Thanks MPiccinato,

That worked great. Another problem I've run into (same situation).

[content] => Array
        (  
          [body] => Array
                (
                    [#weight] => 1
                    [#value] => Cranberry, Orange, and Taupe Vintage Paisley Print
                    [#printed] => 1
                )
          )

Trying to output it like this did not work:

<?php print $content['body']['#value'] ?>

It leaves me with a blank screen.

-- If no-one asked Drupal questions there would be no Drupal answers --

FranCarstens’s picture

This works:

<?php print $node->content['body']['#value'].""; ?>

I don't know why though, so if someone can explain, that'll be nice.

-- If no-one asked Drupal questions there would be no Drupal answers --