Radio Buttons in Blueprint best template code

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…

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.

1 Like

@chrisgwynne What exactly do you want to achieve? Having a field for ratings in a blueprint is one thing but you would have to

  • have a way for website users to rate things on the frontend
  • have a way to display the resulting rating on the front-end (using svg or whatever and the related conditions in the PHP code)