Zum Inhalt springen

tt_ratings: Fehlerhafte Darstellung der Bewertungssterne

Erstellt am 7. März 2010 · Noch keine Antworten

Tags: Frage

Unbekannter Benutzer ·

Moin,
ich habe die tt_ratings installiert um einige Seiten bewerten zu lassen.
Für die Bewertung möchte ich gerne Sterne dargestellt haben. ähnlich wie bei YouTube u.ä.
Bei einem gearden Rating also z.B. 5.00 funktioniert das auch. Es werden 5 gelbe und 1 grauer (best-rating: 6, worst-rating:1) dargestellt.
Bei ungeraden Wertungen also z.B. 2.50 werden nur (positive) gelbe Sterne angezeigt und nicht wie gedacht zwei-einhalb gelbe sterne.

Hier der Code des Plugins für's rendernd es Objekts:

10 = IMAGE
    10.file = GIFBUILDER
    10.file {
      backColor = {$cSet.pageColor}
      transparentBackground = 1
      XY = [10.w]*{$plugin.tx_ttrating_pi1.tileImg},[10.h]
      10 = IMAGE
      10 {
        file = {$plugin.tx_ttrating_pi1.badImgFile}
        mask = {$plugin.tx_ttrating_pi1.maskImgFile}
        tile = {$plugin.tx_ttrating_pi1.tileImg},1
      }
      15 = WORKAREA
      15.set = 0,0,###RATING###*[10.w],[10.h]
      20 = IMAGE
      20 {
        file = {$plugin.tx_ttrating_pi1.goodImgFile}
        mask = {$plugin.tx_ttrating_pi1.maskImgFile}
        tile = {$plugin.tx_ttrating_pi1.tileImg},1
      }
    }

Hier einmal die Beschreibung aus dem Manual dazu:

This is the object to output the result. Have a look at the plugin.tx_ttrating_pi1 TypoScript example.

In this object there will be done a few string substitutions. This is for output rating values and bars etc.

Example:

.highestRating = 5.lowestRating = 1.ratingOutputWidth = 150

new rating is 4

Following string substitutions will be done:

###VOTES### tt_rating.votes, count of all votes

###RATING###tt_rating.rating, average rating

Following values are usefull to create bars:

###HIGHESTRATING###this is 5 in this example

###LOWESTRATING###this is 1

###RATINGMUL### this is 80/100 (80%)

###RATINGFULLWIDTH###is 150. This is the full length (= .ratingOutputWidth)

###RATINGWIDTH###is 120 (80%) here. This is the width of the rating

###RATINGREMAINWIDTH###is 30 here. RATINGFULLWIDTH - RATINGWIDTH

Link zum: Onlinemanual

Und noch meine Constants:

plugin.tx_ttrating_pi1 >
plugin.tx_ttrating_pi1 {

#defaultCode
defaultCode = RESULT, VOTEFORM

#Allow plugin to create new records
allowNew = 1

# cat=plugin.rating/typo; type=; label= Vote form data.
formdata = | *tx_ttrating[EDIT][rating]=select |6 - sehr gut=6, 5 - gut=5, 4 - befriedigend=4, 3 - ausreichend=3, 2 - mangelhaft=2, 1 - ungenügend=1 || | formtype_db = submit | bewerten

# cat=plugin.rating/typo; type=; label= Text to show if not rated yet.
notRatedMsg = Noch keine Bewertungen vorhanden.

# cat=plugin.rating/typo; type=; label= Text to show if just rated.
submittedRatingMsg = Ihre Bewertung <b>###SUBMITTED_RATING###</b>.

# cat=plugin.rating/typo; type=; label= Text to show if user try to rate twice.
doubleRatingMsg = Sie haben bereits eine Bewertung abgegeben.

# cat=plugin.rating/typo; type=; label= Text to show below your rating bar.
textOutput = <b>###RATING###</b><br />(###VOTES### votes)

# cat=plugin.rating/typo; type=int; label= The highest possible rating. (examples: 5 [best] - 1 [worst], 1 [best] - 6 [worst])
highestRating = 6

# cat=plugin.rating/typo; type=int; label= The lowest possible rating.
lowestRating = 1

# cat=plugin.rating/typo; type=int; label= For statistics logging. This should match the steps in the form.
ratingStatSteps = 6

# cat=plugin.rating/typo; type=int; label= The length of a bar or similiar.
ratingOutputWidth = 6

# cat=plugin.rating/typo; type=; label= Image used to render the 'good' bar.
goodImgFile = EXT:tt_rating/res/star.gif

# cat=plugin.rating/typo; type=; label= Image used to render the 'bad' bar.
badImgFile = EXT:tt_rating/res/star_grey.gif

# cat=plugin.rating/typo; type=; label= Image used to mask both images against the background color.
maskImgFile = EXT:tt_rating/res/star_mask.gif

# cat=plugin.rating/typo; type=int[1-20]; label= Should the image be tiled (example: 5 stars). If not set it to 1.
tileImg = 6
}

[/quote]

Habe schon das Original schon etwas angepasst, sodass wenigstens bei geraden Wertungen die Sterne korrekt angezeigt werden. Dazu habe ich

15.set = 0,0,###RATINGMUL###*[10.w]*$plugin.tx_ttrating_pi1.tileImg},[10.h]

durch

15.set = 0,0,###RATING###*[10.w],[10.h]

ersetzt.

Vielleicht kann mir da wer weiterhelfen?