Hi! Thanks for a great module.

I hope this is a pretty straightforward request. I use a lot the custom node-type.tpl.php theme files and on one of these I am not using the $content field but pulling custom fields from CCK and displaying them. As far as I can tell, the code for fivestar is embedded into the $content output and so I was wondering what code I can put in my custom node theme file to display the fivestar vote information.

I hope this is clear and that someone can help!

Adam

Comments

kloewer@drupal.org’s picture

print $node->content['fivestar_widget']['#value']
quicksketch’s picture

Status: Active » Fixed

If you've selected "hidden" in the Fivestar settings, the widget won't be loaded in the content array. You could also use this code to get the form in this scenario.

print fivestar_widget_form($node);

softtouch’s picture

I have a similar issue. I do in a taxonomy-term.tpl.php

print fivestar_widget_form($node);

but it display the non-javascript version only (no star images, just a drop-down box).
The node is loaded before the call to fivestar_widget_form.
I believe (not sure), I have to add anyhow the javascript via a call?

softtouch’s picture

I added fivestar_add_css and fivestar_add_js, but it wont display the stars, it only displays plain html for the fivestar.
And that only in customized page-node-xxx.tpl.php.
I call there fivestar_widget_form($node). It displays a combobox where I can rate. In any normal node content, like blogs, it displays properly the stars.

gemini’s picture

I'm having the same thing with the views... but it only appears in Firefox. It doesn't appear in IE.

chadchandler’s picture

@ gemini

Are you logged in when you try in IE? You might have some user access controls(i.e not allowing anonymous users to view 5star)

gemini’s picture

I meant that the HTML version of the widget was only appearing in the Firefox. In IE everything is working just fine.

softtouch’s picture

I never get it to display the stars if I add the code in a custom node-xxx.tpl.php. It ALWAYS displays only the html version (with the dropdown box)...

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

softtouch’s picture

Status: Closed (fixed) » Active

I never get it to display the stars if I add the code in a custom node-xxx.tpl.php. It ALWAYS displays only the html version (with the dropdown box)...

chadchandler’s picture

Please post the code snippet you are using to call the stars.

softtouch’s picture

Its this:

print fivestar_widget_form($node);

And it only displays the non-js version.
I saw in the source, that the js is not added, thats why the html version only.

I tried too:
fivestar_add_css and fivestar_add_js
fivestar_widget_form($node). It displays a combobox where I can rate. In any normal node content, like blogs, it displays properly the stars.

Anonymous’s picture

Make sure you have jstools installed. I had the same issue as Adam, but after I installed jstools, it displays the stars as expected.

mmerlange’s picture

Hi,

I have 3 cck fivestar fields in my node. One is field_price.
In my template, I can manage to display a static view (example: print $field_price[0][view];) but cannot rate: it's a static!
How can I allow users to rate?
On my (non customised) edit view, they appear and work. How can I hide them?

Thank you,
Michael

chadchandler’s picture

@mmerlange

There might be a display setting when you create rating as a cck field. Admin>>content types >>display ?

natrio’s picture

Is there any way I can get the display stars for average vote OR user vote only?
Maybe there's a variable/function I might missed (maybe something like $node->content['fivestar_widget']['avg_stars']['#value']) ?

chadchandler’s picture

Yes, that is configurable in the content type you are using the fivestar in.

natrio’s picture

Mm... maybe I should be a bit clearer ^_^

I want to display user voting star and/or average star, but I want to split them in the node.tpl.php, so, ie. I can display average star at the top page and voting star in the middle of the page. Can I do this?

najibx’s picture

yeah ...I would like to know this in conjuction with direct rating widget discussed in http://drupal.org/node/185074.

quicksketch’s picture

Also, this issue has come up before: Make sure that you've enabled Fivestar for the content type that you're trying to print out the widget for. Calling the form manually won't work properly unless rating is enabled on that content type.

Regarding #13, you do not have to install or enabled jstools. It has nothing to do with Fivestar and should make no difference.

quicksketch’s picture

Status: Active » Closed (fixed)

Closing after lack of activity.

czeky’s picture

print fivestar_widget_form($node); 

this prints out the whole widget, is it possible to give it some attributes to pront out just a average stars? not clickable widget?

franckweb’s picture

You can use the block that comes with fivestar module. It is in the block section, just add it to any region and don't forget to active fivestar module for the node type of your choose.