444 Part II: Developing an Ajax Library^
Then on the server side, there could be a simple selection to indicate which template to
return.
if ($rating == 4 || $rating == 5)
$theFile = "templates/rating-good.tpl";
else if ($rating == 3)
$theFile = "templates/rating-neutral.tpl";
else
$theFile = "templates/rating-bad.tpl";
In this simple case, a different image and alternate text would be presented depending
on the rater’s attitude.
Of course, this is just a basic idea of the value of dynamic templates. Different templates
could be sent to address browser quirks, user preferences, or even to localize content.