Rating System

From TMM Wiki
Revision as of 15:37, 11 February 2009 by Tmmdan (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
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}