I’ve decided to add some rating to “comments” of my blog model applied to lyrics. (I can test versions in 1.0.11 or 1.1.0 and same bad behaviour).
Before using CStarRating, I just had to add a new column rating to my table of comments. Then, to make the display, inside the loop of post comments ([font="Courier New"]$comment->rating[/font]) I use:
if ($comment->rating>0)
$this->widget('CStarRating',
array('name'=>'rating',
'readOnly' =>true,
'value' => $comment->rating,
'starWidth' => 8,
'titles'=>array(1=>'weak',2=>'so so',3=>'good',4=>'thats great',5=>'the best'),
'maxRating'=>5,
'allowEmpty'=>true)
);
And in the form, waiting for a new comment , I use :
$this->widget('CStarRating',
array('name'=>'rating',
'readOnly' =>false,
'starWidth' => 8,
'titles'=>array(1=>'weak',2=>'so so',3=>'good',4=>'thats great',5=>'the best'),
'maxRating'=>5,
'allowEmpty'=>true));
Nothing extraordinary ! Look at parameter “readOnly” . In the list loop, I want it “true” for the rating has been posted and it should not be changed any more by anyone. Problem is it doesnt behave correctly . What did I miss ?
Do I have to do some pre-settings or registration script before using CStarRating ?
Anyone has an online example - working one - of CstarRating ? Mine, which is faulty now is on http://www.discardedteenz.com/post/salt-water-lyrics. But I am waiting for your helps to solve that !