We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Poll options in version 2

Development and Programming

tunnel7's avatar
tunnel7
125 posts
15 years ago
tunnel7's avatar tunnel7

Hello. Now that LG Polls isn’t an option in EE v2 what are folks using for creating polls?

       
tunnel7's avatar
tunnel7
125 posts
15 years ago
tunnel7's avatar tunnel7

Anyone? 😊

       
huulbaek's avatar
huulbaek
71 posts
15 years ago
huulbaek's avatar huulbaek

Second that… 😊

       
tunnel7's avatar
tunnel7
125 posts
15 years ago
tunnel7's avatar tunnel7

For this project I ended up using the poll functionality in the forums and simply linking to the thread … obviously not ideal if you’re not using the forums but wanted to mention in case it helps someone else out.

       
Susan Snipes / Q Digital Studio's avatar
Susan Snipes / Q Digital Studio
59 posts
15 years ago
Susan Snipes / Q Digital Studio's avatar Susan Snipes / Q Digital Studio

Heh, guess no one is using polls these days? But, if so, I’d love to hear ideas too.

       
Henrik Eklund's avatar
Henrik Eklund
34 posts
15 years ago
Henrik Eklund's avatar Henrik Eklund

me too 😊

       
huulbaek's avatar
huulbaek
71 posts
15 years ago
huulbaek's avatar huulbaek

For my project I ended up using Solspace’s Freeform. That and some embedded PHP made it very easy - the voting system was coded in less than an hour. And for displaying the results I used Googles Visualization API.

       
dominickelly's avatar
dominickelly
179 posts
15 years ago
dominickelly's avatar dominickelly
For my project I ended up using Solspace’s Freeform. That and some embedded PHP made it very easy - the voting system was coded in less than an hour. And for displaying the results I used Googles Visualization API.

This warrants a blog post! Care to write one for ‘the community’? 😉

       
dominickelly's avatar
dominickelly
179 posts
15 years ago
dominickelly's avatar dominickelly

How client friendly is this approach?

       
huulbaek's avatar
huulbaek
71 posts
15 years ago
huulbaek's avatar huulbaek

Well, I don’t know about a blog post - it would only serve to display my lack of programming skills 😊

But I think it’s very friendly.

I have a voting template that I embed in other templates if a vote has been posted. For example in my template for displaying a channel entry I have:

{if poll_question}
    {embed="voting/vote" entry_id="{entry_id}" poll_question="{poll_question}"}
{/if}

Then in voting/vote I have PHP enabled on output and have something like this:

{if logged_in}
{exp:freeform:form collection="{embed:entry_id}" required="stemme"}
{if duplicate} // Show results
    <?php
    {exp:freeform:count collection="{embed:entry_id}" stemme="Yes"}
    <?php 
    $count_yes = {count};
    ?>
    {/exp:freeform:count}
    {exp:freeform:count collection="{embed:entry_id}" stemme="No"}
    <?php 
    $count_no = {count};
    ?>
    {/exp:freeform:count} 
    {exp:freeform:count collection="{embed:entry_id}" stemme="Blank"}
    <?php 
    $count_blank = {count};
    ?>
    {/exp:freeform:count}
    <?php
    $total_count = $count_yes + $count_no + $count_blank;
    $percent_yes = $count_yes / $total_count * 100;
    $percent_no = $count_no / $total_count * 100;
    $percent_blank = $count_blank / $total_count * 100;
    print 'http://chart.apis.google.com/chart?chxl=0:|Vote result&&chxs;=0,676767,11.5,-0.5,l,676767&chxt=x,y&chbh=a,5&chs=340x245&cht=bvg&chco=A2C180,C15B5B,C3BBAE&chd=t:';
   ?>
{/if}
{if not_duplicate}
<?php
    print '<div class="votingbox">
   <strong>{embed:poll_question}</strong>

      <input type="radio" name="stemme" id="stemme_1" value="Yes" /> Yes 

      <input type="radio" name="stemme" id="stemme_2" value="No" /> No 

      <input type="radio" name="stemme" id="stemme_3" value="Blank" /> Blank 


   <div align="center"><input type="submit" name="submit" value="VOTE" class="form-submit" /></div>
</div>';
?>
{/if}
{/exp:freeform:form} 
{/if}

That’s actually more or less it. For this system I always only have three choices of answers to the poll question. But it’s not hard to make these choices custom and loop through the answers.

It’s possible to use a variety of possibilities for displaying the results: http://code.google.com/intl/en-US/apis/chart/docs/chart_wizard.html

       
dominickelly's avatar
dominickelly
179 posts
15 years ago
dominickelly's avatar dominickelly

Thanks for sharing, very, very appreciated! Do you happen to have a working example of your code too?

       
huulbaek's avatar
huulbaek
71 posts
15 years ago
huulbaek's avatar huulbaek

Well, yes and no 😊 It is working perfectly on a production site but it is implemented a little differently. You have to be registered user to vote and there’s a vote-start vote-end date on the votes. This way the users cannot see the result on the vote until the voting has ended. So it’s not really possible for you to view the whole voting process with voting and displaying the results.

Come to think of it, there is one vote where you can see it (the first test of the voting): http://www.parlamentet.dk/blogs/artikel/roder_med_afstemningssystemet

But you have to register on the site first: http://www.parlamentet.dk/medlem/profil

Let me know if you do it so I can delete your user afterwards 😉

       
Tom Jaeger's avatar
Tom Jaeger
497 posts
15 years ago
Tom Jaeger's avatar Tom Jaeger

I was just reading this thread and thought it was worth mentioning that we just released a polls module for ExpressionEngine 2. Check it out: http://eeharbor.com/polls/ If you have any questions feel free to email us.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.