After having solved How to calculate the average Fivestar rating correctly?, I have a computed field Average score that displays the average score of a node. I sometimes want to display this field in a View as a rating (e.g. 4.2/5) and add some more markup to it. For the moment, I have different templates of the form views-view-field--MY-VIEW--field-average-score.tpl.php with the same code:
<?php $rating = round(($output/100) * 5, 1); ?> <span> <span class="star"></span><span><?php print $rating . '/5'; ?></span> </span>
Having all these duplicate templates seems silly to me. Is there a way to only have one and somehow point out which Average score fields should be styled accordingly? Simply using views-view-field--field-average-score.tpl.php is not what I want, since I don't always want to style Average score like this.