Hi
I m using drupal 7 with views, panel and rate module
Problem is that in node rate module is not working
so please help me to show this module in panel. Thanks

CommentFileSizeAuthor
#3 problem.jpg64.03 KBvitkuz

Comments

bdtushar’s picture

I have tried by views, but there is no option, then what to do

jitse’s picture

To display the rating of a node, get the node and display the rating.
You could add some code in a custom contentpane for instance and put in the following code assuming you have a nodeid in $nid and the name of your rate widget is node_rating (machinename):

        $node = node_load($nid);
        node_invoke_nodeapi($node, 'view');
        print $node->rate_node_rating['#value'];

It would be wise to look around in the issuequeue as i believe it is mentioned somewhere around here too.
..the supplied README.txt in the module is a good place to start.

vitkuz’s picture

StatusFileSize
new64.03 KB

Integration with views does not work well in D7. Widget doesn't show. I think it is because I can't select non of my "Vote tag" when i define relationships. I attached screenshot.

Can you help ?

jienckebd’s picture

#2 didn't work for me with the current version of Rate.

I was able to get the voting results using rate_get_results() in rate.module. Below is an example:

$rating = rate_get_results('node', $nid, 1);
print $rating['rating'];

Where the first argument is either 'node' or 'comment', $nid is the node ID, and 1 is the rate widget ID. You can get the rate widget ID by going to admin/structure/rate and looking at the ID in the URL. Look over the function in rate.module for more help.

robertgarrigos’s picture

Status: Active » Fixed

It is in the readme file:

8. Using rate in blocks or panels
--------------------------------------------------------------------------------
You can place the rate widget on a node page in a block or (mini) panel. Add
a custom block with the PHP code input filter or a panel with PHP code and use
the following code:

if (arg(0) == 'node' && is_numeric(arg(1)) && ($node = node_load(arg(1)))) {
  print rate_embed($node, 'NAME');
}

Replace NAME by the widget's machine readable name. If you already have a loaded
node object, you just need the "print rate_embed" line.

You may also use different build modes:

print rate_embed($node, 'NAME', RATE_FULL);
print rate_embed($node, 'NAME', RATE_COMPACT);
print rate_embed($node, 'NAME', RATE_DISABLED);
print rate_embed($node, 'NAME', RATE_CLOSED);

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ivnish’s picture

Assigned: bdtushar » Unassigned
Issue summary: View changes