2

I am using rate module and the number up down widget, and in the settings for this module I had set it to appear at the top of content. It was appearing fine. However, now I am using a panel for this node and the widget no longer appears as expected. I need to embed it into my panel. How would I go about this? I have done a few searchs and found rate_embed, but I am not having any luck getting this to work. I have tried the following. My rate widget is called 'points', and its settings are at /admin/structure/rate/:

function:

<?php rate_embed(&$node, $machine_name, $mode = RATE_FULL); ?>

What I tried:

<?php print rate_embed($node, 'points', $mode = RATE_FULL); ?>
<?php echo rate_embed($node, 'points', $mode = RATE_FULL); ?>

this was giving an error that rate_embed was acting on a non-object.

2
  • you have to display only count value alone?
    – Sathiya
    Commented Dec 10, 2012 at 6:29
  • No, I want to display the actual widget itself in my panel so that a plus / minus number button appears for the user to vote. Commented Dec 10, 2012 at 9:58

1 Answer 1

3

You can try the following code.

 $up_down = rate_generate_widget('1', 'node', {current node id}, RATE_FULL, TRUE, FALSE, NULL);
 print render($up_down);
3
  • this module could also work nicely with this code: drupal.org/project/widgets Commented Dec 11, 2012 at 11:28
  • how would I get the current node id in there? curently that code gives: Parse error: syntax error, unexpected '{' in /home/andrewwe/public_html/wequest.co.uk/modules/php/php.module(80) : eval()'d code on line 4 Commented Dec 12, 2012 at 17:16
  • You can get node id as arg(1). Verify did you enabled rating for that particular content type /admin/structure/rate/
    – Sathiya
    Commented Dec 13, 2012 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.