Results 1 to 7 of 7

Thread: ratings &  html export

  1. #1

    Default ratings &  html export

    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.

  2. #2

    Default Re: ratings &  html export

    Anybody any Ideas?

  3. #3
    Join Date
    Jun 2007

    Default Re: ratings &

    i also like to use this possibility

  4. #4

    Default Re: ratings &

    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 .


  5. #5

    Default Re: ratings &  html export

    thanks a lot
    I can't wait !!!

  6. #6

    Default Re: ratings &  html export

    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');

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

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

    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.


  7. #7

    Default Re: ratings &  html export

    I tried and it worked fine
    Thanks a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts