Plugin: Poll Position: Champion Results Template


One of the premium features of Poll Position: Champion is the custom results template module, which allows you to customize and modify the poll results display with your own HTML, CSS, and MT tags.

To get started with custom poll results, you’ll need to create a Template Module named “Poll Position Results” at the blog or System level. (A Template Module may have been created for you if you have created a new blog.) Be sure to deselect the Use Google Charts checkbox, which will cause the new template to be used.

The results template is in the Polls context, so you can use many of the available template tags, including entering the Choices context to display results, as in the simple template below.

<div class="poll-results">
    <mt:PollChoices>
    <div class="poll-result">
        <p><mt:PollChoiceText> has <mt:PollChoiceVotes> votes.</p>
    </div>
    </mt:PollChoices>
</div>
<div class="poll-total">
    <p>Total votes: <span><mt:PollTotalVotes></span></p>
</div>

Using the custom results template allows you to create your own HTML, and a Google Chart can still be used in the template with the PollCachedChartImage tag, as below.

<div class="poll-results">
   <mt:PollCachedChartImage>
</div>
<div class="poll-total">
    <p>Total votes: <span><mt:PollTotalVotes></span></p>
</div>

Getting Per-Page Results

You may need to create different poll results for the Main Index and Entry archives, for example. The PollDisplayResults tag will help do this, but first you need to set a form element in the poll form. (You’ll need to use a custom poll form to add the needed input object; CompletePoll can not be used to do this.)

<input type="hidden" name="display_results" value="entry" />

display_results will be submitted with the poll, and it’s value is available in the PollDIsplayResults tag in the results template, as below.

<div class="poll-results">
<p>PollDisplayResults tag: <mt:PollDisplayResults></p>
<mt:If tag="PollDisplayResults" eq="entry">
    <mt:PollCachedChartImage>
<mt:Else>
    <mt:PollChoices>
    <div class="poll-result">
        <p><mt:PollChoiceText> has <mt:PollChoiceVotes> votes.</p>
    </div>
    </mt:PollChoices>
</mt:If>
</div>
<div class="poll-total">
    <p>Total votes: <span><mt:PollTotalVotes></span></p>
</div>