Rating with Stars
I want to be able to write some reviews and graphically rate them with stars. I put together some transparent stars in Gimp and added a macro to dasBlog.
I’m going to rate this effort:
$stars(4.5)
To get this effect, I simply wrote $stars(4.5).
(And I had to carefully construct the previous sentence so that dasBlog wouldn’t invoke the stars macro.)
I’m hardnosed. I rarely give 5/5 to anything. I don’t really expect to need the half stars, but I may want that fine control at some point.
To use this in your own blog, download the zipfile of star images.
Copy 5star*.gif to your blog’s images directory. The *.xcf files are Gimp source files.
Add the following line to the <ContentFilters> section of your blog’s site.config:
<ContentFilter find="\$stars\((?<expr>[\d.]+)\)" replace="<div><img src="images/5star${expr}.gif" /> ${expr} stars out of 5</div>" isregex="true" />
Enjoy!
blog comments powered by Disqus