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
Comment #1
kloewer@drupal.org commentedComment #2
quicksketchIf 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);Comment #3
softtouch commentedI 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?
Comment #4
softtouch commentedI 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.
Comment #5
gemini commentedI'm having the same thing with the views... but it only appears in Firefox. It doesn't appear in IE.
Comment #6
chadchandler commented@ 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)
Comment #7
gemini commentedI meant that the HTML version of the widget was only appearing in the Firefox. In IE everything is working just fine.
Comment #8
softtouch commentedI 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)...
Comment #9
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #10
softtouch commentedI 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)...
Comment #11
chadchandler commentedPlease post the code snippet you are using to call the stars.
Comment #12
softtouch commentedIts 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.
Comment #13
Anonymous (not verified) commentedMake sure you have jstools installed. I had the same issue as Adam, but after I installed jstools, it displays the stars as expected.
Comment #14
mmerlange commentedHi,
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
Comment #15
chadchandler commented@mmerlange
There might be a display setting when you create rating as a cck field. Admin>>content types >>display ?
Comment #16
natrio commentedIs 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']) ?
Comment #17
chadchandler commentedYes, that is configurable in the content type you are using the fivestar in.
Comment #18
natrio commentedMm... 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?
Comment #19
najibx commentedyeah ...I would like to know this in conjuction with direct rating widget discussed in http://drupal.org/node/185074.
Comment #20
quicksketchAlso, 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.
Comment #21
quicksketchClosing after lack of activity.
Comment #22
czeky commentedthis prints out the whole widget, is it possible to give it some attributes to pront out just a average stars? not clickable widget?
Comment #23
franckweb commentedYou 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.