Author Topic: Visual Display of Star Ratings  (Read 2366 times)

Offline IanGoldstein

  • Member
  • **
  • Posts: 98
    • View Profile
Visual Display of Star Ratings
« on: July 25, 2007, 07:07:33 AM »
While most code replacement usage appears to be for sports photography, I have found some other uses that work well for me.

In this example, I am using it to allow me to have a visual display of star ratings in slideshows and/or captions using a series of "*" characters corresponding to the rating. In other words, it allows me to display "*" for 1 star photos, "**" for 2 star photos, etc.  For unrated photos, no stars are displayed. If you use the {stars} variable itself, you see text such as "unrated", "1 star", "2 stars", etc.

The attached code replacement file has a list of the various star ratings. If you look at the file, you'll see that I prefer to show multiple star ratings with a space between the stars (e.g. "* * *"). This can easily be adjusted to meet your own preferences.

However, it is worth noting the format of the first entry of the file...

    starsunrated

This entries is followed by a tab and then a space character. This is the trick that provides for the "optional" display of the star rating.

To actually use this replacement in captions for slideshows, image galleries, etc. you need to include the following "pseudo variable"...

   \stars{stars}\


-Ian


[attachment deleted by admin]
« Last Edit: July 25, 2007, 08:06:45 AM by IanGoldstein »