3

I use Drupal 7.

I have a custom content type which, among other fields, uses Fivestar ratings.

I would like to have my node content enriched with microdata/microformarts/rdf so that it appears in Google Rich Snippets.

I tried RDF module, but it cannot apply detailed formating at the Fivestar module results, because Fivestar produces rating and number of reviews as one field.

I would like to recreate node.tpl.php, by printing field by field and not just $content. Also I would like to find out how to break down the fivestar two number results down to each compenents, so that I can put the right microdata in the markup.

More information about rich snippets is at http://www.google.com/support/webmasters/bin/answer.py?answer=99170.

How I can find out the variables and arrays that are used to print the content of a node?

How can I print one by one at node.tpl.php, so that I am able to put the right rich snippets markup in between?

edit: ok, till now I have found about devel module and that I must use dpm($content) inside my node--type.tpl.php. I manage to print render($field_names) of various other fields, but I could not yet understand yet about fivestar module values.

1

This can be accomplished by printing the values you're self instead of letting fivestar do the default rendering.

Here's an example:

$results = fivestar_get_votes('node', $node->nid, 'tag');
//$results now has everything you need to do microformats

The results will have the average and counts. You can print those variables where ever you like. Also note you probably should disabling the text display on the fivestar widget.

There is also an issue over at http://drupal.org/node/901260.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.