Summary:Vote on a page's popularity
Prerequisites:PmWiki 2.2.0beta+
License: Unknown (see note)

How can I choose the most popular page(s), topic(s), product(s) on the site?

You can use the PageRank tool to allow users to vote on whether they like anything that's attached to a single page. With modifications, this could be extended to multiple items on a page.


Plug-in for page ranking system.


This is a basic page-ranking system. It could use some improvements graphically, but basically it allows users to vote (default 1-5) on a page. It only requires CSS, no JavaScript is used.

Security Note until PmWiki comes out with "insert" permissions, this recipe can add information to pages regardless of whether the user has edit/read permissions. Only enable this recipe on pages you wish rankings to be on, and note that the only "security" feature is the default that requires users are logged in. Later this recipe will require "insert" permissions.


  • Place pagerankstars.phpΔ into your pmwiki/cookbook folder
  • Place into your pub/images folder
  • add this line to config.php:


Votes by login

The default behavior of the script is to track votes by login. This means that if a user votes again, it changes their original vote.

To rate a page by login

If you would like to use the PageRank in a specific group, add the following to GroupHeader or to GroupFooter:

(:if authid :)

To allow votes regardless of login

This behavior accumulates votes, regardless of whether the user is logged in or not. If a user votes again, it's counted as an additional vote.

  • in config.php, and BEFORE including star_ratings.php:
    $PRS_Vote['exclusive'] = false;
  • Add to GroupHeader or GroupFooter:

To display the page rating

This displays the page rating only if the page is rated, and is added to the GroupHeader or GroupFooter. A visual star interpretation will come in a later release.

(:if ! equal {*$RatingAverage} "" :)
Rating: {*$RatingAverage} / 5 ({*$RatingCount} votes)


These are the options enabled by the recipe so far:

change the star image

You may use other images than stars, or different star images. The "empty" image should be on top, the "filled" image should be on the bottom, thus the image should be half as wide as it is high. See star_rating.gif for an example. Use the new image by changing the following settings:

  • Add to config.php
    $PRS_Vote['vote_image_url'] = "path/to/image/image.gif";
    $xesVote['star_width'] = ##; // put the width of your image here

change the range for ratings

You may change the number of stars or the range of the vote.

Example: If you prefer a vote of 1-4 instead of 1-5, change the following:
$PRS_Vote['max_stars'] = 4;

list the user votes on the page

The following will tally the user votes visibly. Due to a bug in PmWiki, the votes had to be placed at the top of the page being edited, so you will want to use GroupHeader to display the voting results.

$PRS_Vote['hidden'] = false;

Release Notes

Version 0.1 released - adapted from tutorials at, a website that no longer exists (2014). Uncertain of original licensing. XES contributions CC0 (text) & GPL2 (code) if possible.
Version 0.2 released - bug fixes, documentation corrections
Version 0.3 released - another bug fix
Version 0.4 released - now checks rating entered for numeral.


  • Display stars for current vote.
  • Allow recipe to automatically use correct tense on number of votes cast
  • Allow recipe to use radio buttons instead of an image
  • Test the unhidden feature and the ability to change the number of stars
  • Add in ability for aye/nay/abstain voting for organizations


I like the pagerank recipe, but I would like to limit the number of times a person could rate a page to once. Also, I would like to display a list of the top ranked Authors based on reader rankings. Am I a dreamer?
Scott Ott -> mailto:scottott [snail] scrappleface [period] com

set $PRS_Vote['exclusive'] = true; for people to vote only once. This works best if you require people to log in to vote, of course, otherwise there's no good way to track whether someone has already voted.

Displaying the top rated author would depend on how you have the website configured, and is probably a question more suited for the user list or IRC channel. See MailingLists about the mailing list and for IRC; we're on #pmwiki. For questions (generally free) and (paid) custom programming, I can be contacted personally on AIM or Skype at EclecticTLLC. XES March 01, 2007, at 09:03 PM

See Also



User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.