3

Will this work if i put this inside body field of a node with php filter?

<?php echo "<h4>How are doing? Rate this site</h4>" ?>
<?php print render(field_view_field('node', $node, 'field_fivestar_rating')); ?>

I tried in there but its displays an error.

Notice: Undefined variable: node in eval() (line 2 of C:\ssatempsite\modules\php\php.module(80) : eval()'d code).

EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7562 of C:\ssatempsite\includes\common.inc).

  • $node is not defined. Check this API The entity containing the field to display. Must at least contain the id key and the field data to display. – GoodSp33d Sep 10 '12 at 9:33
1

Use the following code.

  $node = node_load(1);
  print render(field_view_field('node', $node, 'field_fivestar_rating'));

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.