Difference between revisions of "Rating System"

From TMM Wiki
Jump to navigationJump to search
m
 
Line 6: Line 6:
 
system are:
 
system are:
  
* $carma_gal.rating.average - the average rating by all the members who have voted on this gallery
+
* $<content_var>.rating.average - the average rating by all the members who have voted on this gallery
* $carma_gal.rating.my - the rating given to this gallery by the current member
+
* $<content_var>.rating.my - the rating given to this gallery by the current member
* $carma_gal.rating.votes - the number of votes that have been made for this gallery
+
* $<content_var>.rating.votes - the number of votes that have been made for this gallery
 +
 
 +
Where <content_var> is the variable containing the content; depending on the page this will most likely be: $carma_video, $carma_photo or $entry
  
 
== Example ==
 
== Example ==
An example of code that can be used for ratings:
+
An example of code that can be used for rating photo galleries:
  
 
<pre>
 
<pre>
Line 20: Line 22:
 
<input type="hidden" name="id" value="{$carma_gal.galid}">
 
<input type="hidden" name="id" value="{$carma_gal.galid}">
 
<input type="hidden" name="type" value="gal">
 
<input type="hidden" name="type" value="gal">
 +
<select name="rating">
 +
<option value="1">1 - Worst</option>
 +
<option value="2">2 - Bad</option>
 +
<option value="3" selected>3 - Average</option>
 +
<option value="4">4 - Good</option>
 +
<option value="5">5 - Best</option>
 +
</select>
 +
<INPUT id=vote type=submit value=Vote name=vote>
 +
</FORM>
 +
{/if}
 +
</pre>
 +
 +
An example of code that can be used for rating video galleries:
 +
 +
<pre>
 +
{if $carma_video.rating.my}
 +
You Rated This Video {if $carma_video.rating.my == 8}an{else}a{/if} {$carma_video.rating.my}
 +
{else}
 +
<form action="rating.php" method="GET" id=vote name=vote>
 +
<input type="hidden" name="id" value="{$carma_video.galid}">
 +
<input type="hidden" name="type" value="video">
 
<select name="rating">
 
<select name="rating">
 
<option value="1">1 - Worst</option>
 
<option value="1">1 - Worst</option>

Revision as of 07:59, 2 January 2009

CARMA
Templates Admin
Members Area Templates
Tour Templates
Member Favorites
Smarty Loops
Smarty Caching
Smarty print array
Base Templates
User Variables
Rating System

The CARMA rating system has three variables associated with the rating system are:

  • $<content_var>.rating.average - the average rating by all the members who have voted on this gallery
  • $<content_var>.rating.my - the rating given to this gallery by the current member
  • $<content_var>.rating.votes - the number of votes that have been made for this gallery

Where <content_var> is the variable containing the content; depending on the page this will most likely be: $carma_video, $carma_photo or $entry

Example

An example of code that can be used for rating photo galleries:

{if $carma_gal.rating.my}
You Rated This Gallery {if $carma_gal.rating.my == 8}an{else}a{/if} {$carma_gal.rating.my}
{else}
<form action="rating.php" method="GET" id=vote name=vote>
<input type="hidden" name="id" value="{$carma_gal.galid}">
<input type="hidden" name="type" value="gal">
<select name="rating">
<option value="1">1 - Worst</option>
<option value="2">2 - Bad</option>
<option value="3" selected>3 - Average</option>
<option value="4">4 - Good</option>
<option value="5">5 - Best</option>
</select>
<INPUT id=vote type=submit value=Vote name=vote>
</FORM>
{/if}

An example of code that can be used for rating video galleries:

{if $carma_video.rating.my}
You Rated This Video {if $carma_video.rating.my == 8}an{else}a{/if} {$carma_video.rating.my}
{else}
<form action="rating.php" method="GET" id=vote name=vote>
<input type="hidden" name="id" value="{$carma_video.galid}">
<input type="hidden" name="type" value="video">
<select name="rating">
<option value="1">1 - Worst</option>
<option value="2">2 - Bad</option>
<option value="3" selected>3 - Average</option>
<option value="4">4 - Good</option>
<option value="5">5 - Best</option>
</select>
<INPUT id=vote type=submit value=Vote name=vote>
</FORM>
{/if}

An example of code for actor ratings:

{if $actor.rating.my}
You Rated This Actor {if $actor.rating.my == 8}an{else}a{/if} {$actor.rating.my}
{else}
<form action="rating.php" method="GET" id=vote name=vote>
<input type="hidden" name="actorid" value="{$actor.actorid}">
<input type="hidden" name="type" value="actor">
<select name="rating">
<option value="1">1 - Worst</option>
<option value="2">2 - Bad</option>
<option value="3" selected>3 - Average</option>
<option value="4">4 - Good</option>
<option value="5">5 - Best</option>
</select>
<INPUT id=vote type=submit value=Vote name=vote>
</FORM>
{/if}