I’m using radio buttons in Blueprints to do a star rating of 1-5, what’d be the cleanest template code to if 1 star {custom text} else 2star {custom text} etc
Thank you.
I’m using radio buttons in Blueprints to do a star rating of 1-5, what’d be the cleanest template code to if 1 star {custom text} else 2star {custom text} etc
Thank you.
Theres a number of ways explained here… https://css-tricks.com/five-methods-for-five-star-ratings/
Personally I would probably go with the inline SVG example. If you throw class on it with php to output the number rating (remeber css classes cannot start with a number, do it as words instead). Then you can use css nth() to light up the right stars. Set them as gray or whatever in the SVG code and change the fill color with CSS based on the nth needed.
Kirby has an svg helper, so you can keep the SVG in the assets folder, and editable, and kirby will inject it into the page asif it was inline code, so there wont be an extra HTTP request to fetch the SVG.
@chrisgwynne What exactly do you want to achieve? Having a field for ratings in a blueprint is one thing but you would have to