i try to get fivestar widget. in node.tpl.php i can use $node->content['fivestar_widget']['#value'], how can i get this widget in nodes,views,blocks by php code ?, i tried node_load but it doesnt load fivestar_widget

Comments

coreyp_1’s picture

Odd. node_load() should load the fivestar widget, but if it doesn't, you *can* display it programmatically. Look at the fivestar_widget_form() and fivestar_static() functions in the fivestar.module file.

As for Views, the fivestar module comes with views integration, so it should work.

- Corey

robert774’s picture

fivestar_widget_form() works great!!! tnx.

jcjohnson’s picture

I tried outputting the fivestar widget in a custom module as well by doing this but it didn't work:

 $node = node_load($nid);
	print $node->content['fivestar_widget']['#value'];

To save someone some time, this is the exact code that should do it every time provided that you have the node id.

$node = node_load($nid);
	print fivestar_widget_form($node);

Hope the elaboration helps someone. Thank you all for pointing me in the right direction.