How can I correctly display a flexifield in node.tpl.php?
I want to put it in a non-standard position.
Thanks in advance.

Comments

Bob Moyce’s picture

You'll need both the Flexifield value and the value of the field from the Content Type Flexifield is referencing. Assume that field_my_flexifield is your Flexifield and field_my_text is a field within the Content Type:

<?php print $field_my_flexifield[0]['value']['field_my_text'][0]['value']; ?>

If you want to work with several values at once, just run the array as follows:

<?php
  foreach ((array)$field_my_flexifield as $item) {
    print $item['value']['field_my_text'][0]['value'];
    print $item['value']['field_my_text_2'][0]['value'];
  }
?>

Hope that helps.

Bob

sridarm’s picture

Priority: Normal » Major

Hello Bobmoyce ,
But that displays only the content excluding the styles that i have added for the text. I tried a lot of tricks but doesnt shows the style. Can you send the code . Its urgent please

Bob Moyce’s picture

Have you tried using ['view'] instead of ['value']?

Bob

khaleghian’s picture

hello my dear

how can display an title or body from an reference node in an flexifield content type?

Nishchal’s picture

Thanks. It helped me a lot.