PDA

View Full Version : ratings &  html export



ekoliniol
05-08-2007, 02:29 PM
I tried to export ratings using the <rating/> tag and it produces numbers (0-100) in 10 increments. half a star is 10 , 1 star is 20 ... 5 stars is 100.
I tried to export using <ratingcombo/> tag but it produces no stars but empty little boxes.
Can anyone give me a hand on how to produce the star ratings in html ?
I'm using a modified version of CMI_PLAY template.

ekoliniol
12-04-2007, 02:21 PM
Anybody any Ideas?

gino
12-10-2007, 06:32 AM
i also like to use this possibility

Gagliem
07-25-2008, 05:35 AM
Hi There,
I didn't look at CMI_PLAY ever, but the <ratingcombo/> tag produces no stars because it's not a real tag but a sort of container of JavaScript (or also other language, as the source code is owned by Andrei) functions which allows you to interact giving &amp; displaying immediately the rating.

You should use the <rating/> tag and write down a JS function that will parse the tag's value producing stars instead of it.

I did it on OCD v5, but actually I'm rewriting my own theme for OCD v6 and I haven't completed the HTML export, but, during the weekend, if I'll find where the old OCD v5 code is, i'll post it in this topic if it could be useful for you ;) .

Cheers
Emanuele

ekoliniol
07-27-2008, 09:34 AM
thanks a lot
I can't wait !!!

Gagliem
07-27-2008, 07:02 PM
Ok, I found it!

The code could be better as in OCD v5 the rating didn't have half-stars, so I patched it quickly without thinking about a better solution, by the way, I think it should work for you.

Just follow these steps I did with the "Advanced Web Site.dax" (and then you can apply them in your export templates):

1) "Declarations" section
copy this line

STARSIZE ["Rating Stars Size"] : int = 16;

after this existing line

COVERSIZE ["Album cover size"] : int = 100;

2) "Album Page" section

after the line "//--></style>"

copy the following function

<script type="text/javascript">
var Star0 = "Star0.gif";
var Star0_5 = "Star0_5.gif";
var Star1 = "Star1.gif";

function RatingStars(myrating) {
if (parseInt(myrating,10) > 0) {
for (i=0; i<5; i++) {
if (i < (myrating / 100) * 5) {
if ((i+0.5) < (myrating / 100) * 5) {
document.write("<img src='.\\images\\" + Star1 + "' width=$STARSIZE valign='top' border='0' />");
}
else {
document.write("<img src='.\\images\\" + Star0_5 + "' width=$STARSIZE valign='top' border='0' />");
}

}
else {
document.write("<img src='.\\images\\" + Star0 + "' width=$STARSIZE valign='top' border='0' />");
}
}
}
else {
document.write('Not Rated');
}
}
</script>

then place the following line where you want to show the rating stars

<script type="text/javascript">RatingStars('<dax:rating/>')</script><br>

3)
After you've created the directory with your collection, with the Export template, you have to:
- create in it a folder named "images"
- copy in this directory the three gif images related to the rating stars (you can draw them yourself or grab them from rags&amp;tags, etc.) named
"Star0.gif" (a gif displaying a grey star, for example)
"Star1.gif" (a gif displaying a yellow star)
"Star0_5.gif" (a gif displaying a star half yellow, half grey)

Now you should see the rating displaying the stars, then if you want to display them bigger or smaller than I did, you can change the value of "Rating Stars Size" from 16 to the value you desire.

Cheers

ekoliniol
11-30-2008, 08:17 AM
Great
I tried and it worked fine
Thanks a lot