All tags/Rating
Product reviews
The average score of each product as stars - a part of a star filled as far as the score goes.
<?php
$products = [
[ 'product' => 'Walnut desk lamp', 'score' => 4.7, 'reviews' => 214 ],
[ 'product' => 'Linen armchair', 'score' => 4.2, 'reviews' => 88 ],
[ 'product' => 'Oak side table', 'score' => 3.5, 'reviews' => 41 ],
[ 'product' => 'Wool rug, 160x230', 'score' => 2.8, 'reviews' => 17 ],
[ 'product' => 'Ceramic vase', 'score' => 5, 'reviews' => 9 ] ];
?>
<table style="border-collapse:collapse; width:100%">
<tr><th style="text-align:left; padding:6px 12px 6px 0">Product</th><th style="text-align:left; padding:6px 12px">Score</th><th style="text-align:right; padding:6px 0">Reviews</th></tr>
{products}
<tr style="border-top:1px solid rgba(127,127,127,.25)">
<td style="padding:8px 12px 8px 0">{$product}</td>
<td style="padding:8px 12px; white-space:nowrap">{rating $score, size=18} <small>{$score}</small></td>
<td style="padding:8px 0; text-align:right">{$reviews}</td>
</tr>
{/products}
</table>
| Product | Score | Reviews |
|---|---|---|
| Walnut desk lamp | 4.7 | 214 |
| Linen armchair |
|
88 |
| Oak side table |
|
41 |
| Wool rug, 160x230 |
|
17 |
| Ceramic vase |
|
9 |