phpBB Template Design Guide
Recommended Stuff
Recent
Recent blog posts
- Five perhaps not-so-known PHP tricks for leaner and cleaner code
- PHPEclipse and PDT
- Kilowatts & Vanek are back, better than ever
- The future of my phpBB templates
- Checking in
- Web Design or the Art and Science of Solving Problems (Part 1)
- Lost in thought
- An easy way to display a customized menu in your Drupal theme
- Back on the blog with a CSS rant
- Eternal* fame on the red planet for free
Search this site with Google
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.