Difference between revisions of "Rating System"

From TMM Wiki
Jump to navigationJump to search
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
}}
 
}}
  
The CARMA rating system has three variables associated with the rating
+
The CARMA rating system has three variables associated with its system:
system are:
 
  
 
* $<content_var>.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
Line 17: Line 16:
 
<pre>
 
<pre>
 
{if $carma_gal.rating.my}
 
{if $carma_gal.rating.my}
You Rated This Gallery {if $carma_gal.rating.my == 8}an{else}a{/if} {$carma_gal.rating.my}
+
  You Rated This Gallery {if $carma_gal.rating.my == 8}an{else}a{/if} {$carma_gal.rating.my}
 
{else}
 
{else}
<form action="rating.php" method="GET" id=vote name=vote>
+
  <form action="rating.php" method="GET">
<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">
+
    <select name="rating">
<option value="1">1 - Worst</option>
+
      <option value="1">1 - Worst</option>
<option value="2">2 - Bad</option>
+
      <option value="2">2 - Bad</option>
<option value="3" selected>3 - Average</option>
+
      <option value="3" selected>3 - Average</option>
<option value="4">4 - Good</option>
+
      <option value="4">4 - Good</option>
<option value="5">5 - Best</option>
+
      <option value="5">5 - Best</option>
</select>
+
    </select>
<INPUT id=vote type=submit value=Vote name=vote>
+
    <input type="submit" id="vote" value="Vote" name="vote">
</FORM>
+
  </form>
 
{/if}
 
{/if}
 
</pre>
 
</pre>
Line 38: Line 37:
 
<pre>
 
<pre>
 
{if $carma_video.rating.my}
 
{if $carma_video.rating.my}
You Rated This Video {if $carma_video.rating.my == 8}an{else}a{/if} {$carma_video.rating.my}
+
  You Rated This Gallery {if $carma_video.rating.my == 8}an{else}a{/if} {$carma_video.rating.my}
 
{else}
 
{else}
<form action="rating.php" method="GET" id=vote name=vote>
+
  <form action="rating.php" method="GET">
<input type="hidden" name="id" value="{$carma_video.galid}">
+
    <input type="hidden" name="id" value="{$carma_video.galid}">
<input type="hidden" name="type" value="video">
+
    <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>
<option value="2">2 - Bad</option>
+
      <option value="2">2 - Bad</option>
<option value="3" selected>3 - Average</option>
+
      <option value="3" selected>3 - Average</option>
<option value="4">4 - Good</option>
+
      <option value="4">4 - Good</option>
<option value="5">5 - Best</option>
+
      <option value="5">5 - Best</option>
</select>
+
    </select>
<INPUT id=vote type=submit value=Vote name=vote>
+
    <input type="submit" id="vote" value="Vote" name="vote">
</FORM>
+
  </form>
 
{/if}
 
{/if}
 
</pre>
 
</pre>

Latest revision as of 14:37, 11 February 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 its system:

  • $<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">
    <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 type="submit" id="vote" 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 Gallery {if $carma_video.rating.my == 8}an{else}a{/if} {$carma_video.rating.my}
{else}
  <form action="rating.php" method="GET">
    <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 type="submit" id="vote" 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}