1

So many of us know that the Rate module does not smoothly integrate with Panels.

I discovered out a way to get the voting widget to show using a custom content with the following PHP code:

<?php
if (arg(0) == 'node' && is_numeric(arg(1)) && ($node = node_load(arg(1)))) {
   print rate_embed($node, 'bias', RATE_FULL);
}
?>

Has anyone had any luck with doing something similar to display only the vote results (i.e. display total percent of that vote)?

I'm not a PHP wizard, but I think there is way by doing something like the following.

<?php
if (arg(0) == 'node' && is_numeric(arg(1)) && ($node = node_load(arg(1)))) {
   print get_rate_resluts($node, 'bias', RATE_FULL);
}
?>

But end up getting either blank pages or some fatal database errors. Thoughts?

Update: I think I figured out that I need to create a custom content to print the output after reading it here. Tried this:

$block['content'] = rate_get_results('bias', $nid, $widget_id) $output['rating'];

But it looks like it does not do anything which is better then seeing a blank page.

-1
print rate_embed($node, 'NAME', RATE_FULL);

Replace NAME with the machine name of the widget; the view mode can be RATE_FULL, RATE_COMPACT, RATE_DISABLED, RATE_CLOSED, RATE_COMPACT_DISABLED.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy