home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (poll-bar.tpl.php)

This example Drupal source code file (poll-bar.tpl.php) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

bar, class, div, percent, php

The poll-bar.tpl.php Drupal example source code

// $Id: poll-bar.tpl.php,v 1.3 2008/10/13 12:31:42 dries Exp $

 * @file
 * Default theme implementation to display the bar for a single choice in a
 * poll.
 * Variables available:
 * - $title: The title of the poll.
 * - $votes: The number of votes for this choice
 * - $total_votes: The number of votes for this choice
 * - $percentage: The percentage of votes for this choice.
 * - $vote: The choice number of the current user's vote.
 * - $voted: Set to TRUE if the user voted for this choice.
 * @see template_preprocess_poll_bar()

<div class="text"><?php print $title; ?></div>
<div class="bar">
  <div style="width: <?php print $percentage; ?>%;" class="foreground"></div>
<div class="percent">
  <?php print $percentage; ?>% (<?php print format_plural($votes, '1 vote', '@count votes'); ?>)

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal poll-bar.tpl.php source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.