2

I am using Fivestar rating in custom print. See image:

enter image description here

I'm trying to print a fivestar as follows:

$your_average = $variables['result']['node']->field_rating['und'][0]['average'];
$your_maximum = "100";
print theme('fivestar_static', $your_average, $your_maximum);

But, I'm getting the following error:

Fatal error: Unsupported operand types in /var/www/html/book1/includes/theme.inc on line 1088

Any suggestions?

0

2 Answers 2

3

Looking at the definition of fivestar_static theme-function in fivestar.module file under fivestar_theme(), you need to provide the theme function with an array including the following keys: rating, stars, tag. A working example should look like:

$fivestar_variables = array('rating' => $your_average, 'stars' => $your_maximum);
print theme('fivestar_static', $fivestar_variables);
0
-1

Try this:-

$your_maximum="100";
$your_average  = "21";
print render(theme('fivestar_static', $your_average, $your_maximum ));
1
  • I have tried this, but not working. I am getting the same error. Commented Dec 28, 2015 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.