
string getStars ( string $data_get_path )
The function Data::getStars() returns standard star
review icons for use in SearchMonkey presentation applications. You can
use star review icons to create more visually attractive ratings and
reviews. The actual return value is a template string, which Yahoo!
Search interprets and renders as an icon.
getStars() only operates for certain presentation application components:
key/value pairs, infobar summaries, and infobar blobs
(['dict'][),
n]['name']['infobar']['summary'] and
['infobar']['blob']).
To retrieve star review icons using a numeric value rather than a
string path, refer to Data::getStarsFromNum(). To
retrieve any SearchMonkey icon, refer to
Data::getImage().
data_get_path — A string path to a numeric
rating, using the same syntax defined for Data::get(). For example,
Data::getStars('smid:foo/review:rating');
retrieves the rating value from the DataRSS field
smid:foo/review:rating and converts it to the
appropriate star review icon. The field's value must be a numeric
value between 0 and 5, which SearchMonkey then rounds to the
nearest half-integer. If the field does not exist or has a
non-numeric value, the function returns an invalid template
string.
A template string designed to be consumed by Yahoo! Search. When
the presentation application renders on the search results page,
Yahoo! Search resolves the string into an <img>
element with the correct src for the specified
icon.
If you specify a path to a field that does not exist or that has
an invalid value, the function still returns a template string, but
Yahoo! Search displays this invalid template string directly instead
of resolving it into an icon <img> element.