jzhong5
(Jzhong5)
1
Dear all,
Is there a way to render larger stars for CStarRating?
I know I can customize CSS to do it but All i want is to generate some large-size stars…
Any way to achieve this? I tried to set "starWidth="64" but still not works…
Thanks!!
Best,
jiaming
yugenekr
(Yugenekr)
3
starWidth should work according to docs.
which way do you set your CStarRating?
jzhong5
(Jzhong5)
4
<div class="right last" id="rating_info_<?php echo $model->rating_id?>">
<?php
if ( $rating = Rating::model()->findByPk($model->rating_id) ) //if the record has an rating_id we echo it
{
//echo "Rating: <strong>" . $rating->vote_average ."</strong>";
//echo " " . $rating->vote_count . " votes";
}
?>
</div>
<div class="right">
<?php
if(Yii::app()->user->isGuest){
if ( isset($rating->vote_average) ){
$value = round($rating->vote_average,0);
}else{
$value = 0;
}
$this->widget('CStarRating',array(
'name'=>'rating'.$model->rating_id, // an unique name
'starCount'=>5,
'readOnly'=>true,
'resetText'=>'reset',
'maxRating'=>10,
'minRating'=>1,
'value'=>$value,
));
}
else{
if ( isset($rating->vote_average) ){
$value = round($rating->vote_average,0);
}else{
$value = 0;
}
$this->widget('CStarRating',array(
'name'=>'rating'.$model->rating_id, // an unique name
'starCount'=>5,
'readOnly'=>false,
'resetText'=>'reset',
'maxRating'=>10,
'minRating'=>1,
'value'=>$value,
'callback'=>'
function(){
.....
......
......}
Here is all I have for CSTARRATING…add star width simply not works… 
yugenekr
(Yugenekr)
5
I don’t see in the code a line where you set ‘starWidth’ to 64
jzhong5
(Jzhong5)
6
I deleted it since it not works.
$this->widget('CStarRating',array(
'name'=>'rating'.$model->rating_id, // an unique name
'starCount'=>5,
'readOnly'=>true,
'resetText'=>'reset',
'maxRating'=>10,
'minRating'=>1,
'value'=>$value,
'starWidth'=>64,
));
I do it here…
abennouna
(Abennouna)
7
Hi,
I’ve just tested and I have the same behavior, with a simple widget:
$this->widget('CStarRating',array(
'name'=>'rating',
'starWidth'=>64,
));
Digging a little in the code, you can see that starWidth is properly passed by the widget to the jQuery call, ie
jQuery('#rating > input').rating({'starWidth':64});
But when checking jquery.rating.js this line pops out:
I tried to investigate more, but with no luck. I didn’t see exactly in the plugin code where starWidth is applied when the stars are rendered
Maybe try with the newest version? The current (in my case / Yii 1.1.10) is v3.13 - 2009-03-26
jzhong5
(Jzhong5)
8
Wow…thanks for the test…I tried the latest version and it is, still ,not works.
I just found that there are no larger images in the assets folder…also…jQuery.dimensions plugin…do we have this included in yii…?