2

I'm using the Page Manager (Panel) to customize the node layout, and the Rate module to rate them.

How to print the rating widget of the current node using php ?

I've tried to use this code but no result.

<?php  print rate_embed($node, 'page_rating', RATE_FULL);  ?>
  • resolved <?php if (arg(0) == 'node' && is_numeric(arg(1)) && ($node = node_load(arg(1)))) { print rate_embed($node, 'NAME'); } ?> – ijujym Mar 6 '12 at 14:03
2

print rate_embed($node, 'plus1', RATE_FULL);

Here, first parameter($node) is the entity where you want to vote 'plus1' is the type of widget that you want to add RATE_FULL is the display type of widget . Either it can be full or mini.

Try by passing $node =node_load(10). Where 10 is id of some node that exists in the site

Hope it will help

1

print $node->rate_NAME['#markup'];

Replace NAME by the widget's machine readable name.

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.