0

Display the suffix for the field 'price', i use:

<?php
print $node->field_price['und'];
?>

but only it render the value without the suffix ($)

1 Answer 1

3

You should ideally be using the render functions to output the stuff in content and node arrays in Drupal 7, the reason you are not seeing the suffix is that you are simply pulling out a value and not rendering.

So the following should work for you:

<?php echo field_view_field('node', $node, 'field_price'); ?>

Take a look at Drupal's reference on field_view_field and this article too

1
  • thank you, i try this: $field = field_get_items('node', $node, 'field_price'); $output = field_view_value('node', $node, 'field_price', $field[0]); $price = $output['#markup']; echo $output['#markup']; it work fine; result: 290.00$
    – Tayba
    Jun 23, 2012 at 15:44

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.