Having links that show the number of times some content is flagged is easy. All that's needed is to embed a count token in the labels for the links. (You have to have the Token module enabled for this, or for any other token, to work.)
On the flag configuration form, change, for example:
Bookmark this
To:
Bookmark this ([node:flag-bookmarks-count] users have bookmarked this)
You should change the "bookmarks" word, in the token, to the machine name of the flag you're dealing with. It's easier to just open the Tokens fieldset and locate the desired token in the list.
For this feature to work correctly, your Flag module release must be from 2008-10-10 or later.
Global vs non-global flags
Note that the count token is only useful with non-global flags. Global flags are shared among all users and their count tokens will always show either '1' (if the content is flagged) or '0' (if the content isn't flagged).
Making the links a bit more spicy
If you aren't satisfied with plain textual links, if you want to show the number in big type, inside a stylish box, then you can override flag.tpl.php. Some tips:
- The expression
$flag->get_count($content_id)
would give you the number of times the content is flagged. (See the API section.) - You may wish to replace all the SPANs with DIVs.
- You may wish to remove the link from the links section beneath the node and instead place it floating beside the node title; See Placing a flag link on a page
Comments
many look for Digg like tools ...
For anyone who is interested in community discussion and contribution to get tools for Digg like behaviour put together, we discuss this feature over here (#1295160: Gathered: options and tools to create Digg like site with link module) to get it implemented regulary in future releases of link module.
Thanks to all for all the contributions and efforts here and everywhere else on Drupal.org!
You all rock! ~ dqd (formerly diqidoq)
非常有帮助,
谢谢上帝
Correct syntax
There is a problem in the sintaxis
The articule said this
Bookmark this ([flag-bookmarks-count] users have bookmarked this)
But using Token and Drupal 7.16 must be like this
Bookmark this ([node:flag-bookmarks-count] users have bookmarked this)
So you can get similar funtion of likes in Facebook
Any way thanks for the pointers
Regars
Antonio