My BlogAbout MePortfolioTemplatesArticlesWeb StoreMessage Board (Forums)Guestbook

Multiple color poll result bars

When you make a poll topic in phpBB, the result of the votes will be shown as bars, one for each option. These bars consist of three images, a left cap image, an image that is repeated to create the center of the bar and a right cap. The code for these bars can be found in viewtopic_poll_result.tpl.

Originally, the poll result bars werent intended to be designed this way. Instead the developers intended one image to be used, and for it to be stretched by setting its width to represent the per cent of votes. There was also the intention of supporting votebars in several colors, or designs. If you open the CFG file (myTemplate.cfg) you will find the following code:

$images['voting_graphic'][0] = "$current_template_images/voting_bar.gif";
$images['voting_graphic'][1] = "$current_template_images/voting_bar.gif";
$images['voting_graphic'][2] = "$current_template_images/voting_bar.gif";
$images['voting_graphic'][3] = "$current_template_images/voting_bar.gif";
$images['voting_graphic'][4] = "$current_template_images/voting_bar.gif";

By removing the code for adding the left and right end caps and assigning a different bar image for each of these you can display poll results as up to five differently colored bars. I havent used done myself but I imagine that if there are more than five options the colors are reused.

Post new comment



The content of this field is kept private and will not be shown publicly.


*

  • Web and e-mail addresses are automatically converted into links.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
Verify comment authorship
Captcha Image: you will need to recognize the text in it.
*
Please type in the letters/numbers that are shown in the image above.