PDA

View Full Version : Adding "Rating" to Style



kklingerman
01-17-2011, 02:27 PM
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

ekoliniol
01-27-2011, 05:39 PM
I have implemented the rating tag on my site www.ekoliniol.com
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(<!----><!---->)
</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

kklingerman
01-30-2011, 02:53 AM
I have implemented the rating tag on my site www.ekoliniol.com
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(<!----><!---->)
</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.

ekoliniol
01-30-2011, 07:26 PM
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

Gagliem
02-13-2011, 11:35 AM
It seems my JavaScript code I gave you for free in this forum, isn't it ekoliniol? ;-)
http://www.firetongue.com/boards/showthread.php?t=6198&highlight=ratings

@ kklingerman: sometimes, it's useful to use the "search" option in this forum, many issues have been asked before and have already a solution... :)

ekoliniol
02-15-2011, 07:45 PM
yap
sorry for not mentioning it but i couldnt remember your username (too lazy to search the whole forum)
Works great
Thanks again