{$field->field_alias} * * The above will guarantee that you'll always get the correct data, * regardless of any changes in the aliasing that might happen if * the view is modified. */ ?>
{$field->field_alias}; $node = node_load($nid); if (isset($node->field_product_rating[$node->language][0]['average'])) { $average = $node->field_product_rating[$node->language][0]['average']; $stars = 0; if ($average >= 90) { $stars = 5; } else { if ($average >= 70 && $average < 90) { $stars = 4; } else { if ($average >=50 && average < 70) { $stars = 3; } else { if ($average >=30 && average < 50) { $stars = 2; } else { if ($average >10 && average < 30) { $stars = 1; } } } } } $i = 0; while ($i < $stars) { print ''; $i++; } $j = 0; while ($j < 5 - $stars) { print ''; $j++; } } ?>