Showing multi-axis five star values on comments


One of the most awaited features of five star module is "multi-axis". Though few other multi-axis rating systems are available on drupal, none of them are as attractive as five star and the latest version of five star module has overcame it (no its not yet available on official release, but you can download it from one of the comment on support request).

After using it on my site, I wanted to go a bit step further. My goal was to show all the ratings on each comment with an overall rating. The code is given below

$result = db_query("SELECT cid FROM comments WHERE uid=$comment->uid",$uid);
$cid = db_result($result);

$rating = array();

for($i=0; $i<=4; $i++)
{
$rating["$i"]= db_result(db_query("SELECT fc_value FROM fivestar_comment WHERE (fc_comment_id=$cid) AND (fc_delta = $i )"));
}

print '

'. 'Axis1' . theme_fivestar_static($rating[0], 5) .'

';
print '

'. ' Axis2' . theme_fivestar_static($rating[1], 5) .'

';
print '

'. ' Axis3' . theme_fivestar_static($rating[2], 5) .'

';
print '

'. ' Axis4' . theme_fivestar_static($rating[3], 5) .'

';
print '

'. ' Axis5' . theme_fivestar_static($rating[4], 5) .'

';
?>


and the result is shown above

AttachmentSize
fivestar-mutliaxi-on-comment.PNG9.64 KB

С наступающим!

С наступающим Новым годом! Всех Благ!




С наступающим

Статья толково написана, спасибо по ней написал и себе статью на блоге, поздравляю с новым годом

Девушек с приходом весны!

Девушек с приходом весны! Счастья Вам!




Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Based on: ManuScript | Optimized for Drupal :www.SablonTurk.com