Thursday 20 November 2003 2:09:01 am
I have a small control structure that I have written in the ez templating language that is incredibly cumbersome (see below). Can anyone suggest a better way to do this? All it is supposed to do is show an image of start (rating) for different values of user ratings.
---------------------------
{section show=$:item.Rating|gt(4.75)}
<img src={"stars-5-0.gif"|ezimage} alt="Rating: {$:item.Rating}" border="0" />
{section-else}
{section show=$:item.Rating|gt(4.25)}
<img src={"stars-4-5.gif"|ezimage} alt="Rating: {$:item.Rating}" border="0" />
{section-else}
{section show=$:item.Rating|gt(3.75)}
<img src={"stars-4-0.gif"|ezimage} alt="Rating: {$:item.Rating}" border="0" />
{section-else}
{section show=$:item.Rating|gt(3.25)}
<img src={"stars-3-5.gif"|ezimage} alt="Rating: {$:item.Rating}" border="0" />
{section-else}
{section show=$:item.Rating|gt(2.75)}
<img src={"stars-3-0.gif"|ezimage} alt="Rating: {$:item.Rating}" border="0" />
{section-else}
{section show=$:item.Rating|gt(2.25)}
<img src={"stars-2-5.gif"|ezimage} alt="Rating: {$:item.Rating}" border="0" />
{section-else}
{section show=$:item.Rating|gt(1.75)}
<img src={"stars-2-0.gif"|ezimage} alt="Rating: {$:item.Rating}" border="0" />
{section-else}
{section show=$:item.Rating|gt(1.25)}
<img src={"stars-1-5.gif"|ezimage} alt="Rating: {$:item.Rating}" border="0" />
{section-else}
{section show=$:item.Rating|gt(0.75)}
<img src={"stars-1-0.gif"|ezimage} alt="Rating: {$:item.Rating}" border="0" />
{section-else}
<img src={"stars-0-0.gif"|ezimage} alt="Rating: {$:item.Rating}" border="0" />
{/section}
{/section}
{/section}
{/section}
{/section}
{/section}
{/section}
{/section} {/section}
|