Results 1 to 6 of 6

Thread: Adding "Rating" to Style

  1. #1

    Question Adding "Rating" to Style

    Good morning. I have been using the "CMI" style for a long time and now I want to add the album rating to the style. I would like it so that it shows on the Album page in the HTML export.

    I am not the best programmer, but I have been able to make minor as needed. Here is the line I added and the error I get during export to HTML. If you have any insight, I would appreciate it.

    Code:

    <tr>
    <td width="30%" align="right" nowrap><b> &nbsp; Rating: </b></td>
    <td width="70%" bgcolor="$SHADECOLOR2" class="valshade"> &nbsp;<!--[Rating/]--></td>
    </tr>

    Error:

    Invalid Tag Name

  2. #2

    Default

    I have implemented the rating tag on my site [url]www.ekoliniol.com[/url]
    If you like it do this :

    Add the following to the HEAD section :

    <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=$A_P_STARSIZE valign='top' border='0' />");
    }
    else {
    document.write("<img src='.//images//" + Star0_5 + "' width=$A_P_STARSIZE valign='top' border='0' />");
    }

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


    and use the function like this

    <tr>
    <td width="30%" align="right" nowrap><b>Personal Star Rating [1-5] </b></td>
    <td width="70%" bg_color="$shade_color2" class="valshade"> &nbsp;
    <script type="text/javascript">RatingStars(<!--[Rating]--><!--[/Rating]-->)
    </script>
    </td>
    </tr>

    You will have to build 3 gif images: 1 for no star , 1 for half a star and one for full star, and place them in an sub-folder called images .'
    I'm posting mine in case you're interested

  3. #3

    Default

    Quote Originally Posted by ekoliniol View Post
    I have implemented the rating tag on my site [url]www.ekoliniol.com[/url]
    If you like it do this :

    Add the following to the HEAD section :

    <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=$A_P_STARSIZE valign='top' border='0' />");
    }
    else {
    document.write("<img src='.//images//" + Star0_5 + "' width=$A_P_STARSIZE valign='top' border='0' />");
    }

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


    and use the function like this

    <tr>
    <td width="30%" align="right" nowrap><b>Personal Star Rating [1-5] </b></td>
    <td width="70%" bg_color="$shade_color2" class="valshade"> &nbsp;
    <script type="text/javascript">RatingStars(<!--[Rating]--><!--[/Rating]-->)
    </script>
    </td>
    </tr>

    You will have to build 3 gif images: 1 for no star , 1 for half a star and one for full star, and place them in an sub-folder called images .'
    I'm posting mine in case you're interested
    Thank you so much for the response. However, I get a "Undefined Macro" error for "$A_P_STARSIZE". Is there additional code I get to define this? Thanks again for your help.

  4. #4

    Default

    oops !!
    you will have to add the following to the declarations page in the ALBUM PAGE PARAMETERS


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

    When you export you will see 1 new export parameter:

    Rating Stars Size (number)
    Default value is 16 (pixels).
    You can try smaller or greater values to re-size the stars according to the rest of your page

  5. #5

    Cool

    It seems my JavaScript code I gave you for free in this forum, isn't it ekoliniol? ;-)
    [url]http://www.firetongue.com/boards/showthread.php?t=6198&highlight=ratings[/url]

    @ kklingerman: sometimes, it's useful to use the "search" option in this forum, many issues have been asked before and have already a solution...
    Last edited by Gagliem; 02-13-2011 at 11:51 AM.

  6. #6

    Default

    yap
    sorry for not mentioning it but i couldnt remember your username (too lazy to search the whole forum)
    Works great
    Thanks again

Posting Permissions

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