Search

I want to create a simple polling system. Any idea how to implement it? Thanks.

Do you mean you’d like to be able to create and manage polls with a set number of answers that users can vote on in the frontend?

Yes, that’s what I’d like to create. I’m new to Symphony and I haven’t been able to find an extension nor a solution. What sections should I create and a set of extensions should I use? Thanks for any answers or pointers.

Depends on exactly the functionality you need. For now, you’ll want to start with a section called Polls, and an event that is connected to that section (allowing for frontend voting).

As for the structure of the section, that’s up to you of course, but it could actually be fairly simple. Since I imagine the number of options will never get too high, you can just add a static number of fields to your Polls section. You might start with something like the following:

  • Question, text input or text area
  • Option One, text input
  • Option Two, text input
  • Option Three, text input
  • etc… and then:
  • Votes for One, either text input or number (which is an extension)
  • Votes for Two, text input or number
  • Votes for Three, text input or number
  • etc…

What your frontend form would do is take the current number of votes, add 1, and submit the change via the event.

Of course, this is an overly simplistic implementation, and you’ll have to think about security, vote limits and all that. But hopefully this at least gives you a place to start.

Yes, I think it’s enough for now. Making the number of options static is a great idea. Keeping things simple. I’ll think about security and dynamic options later. Thanks for the response.

Making the number of options static is a great idea. Keeping things simple. I’ll think about security and dynamic options later.

You could also create another Section “Possible Answers” with two fields: Answer (Text) and Question (Select Box Link). That way you can have as many answers as you like per question.

It’ll be hard to migrate from a “static” to a “dynamic” answer-system once you have a few questions and answers.

It’ll be hard to migrate from a “static” to a “dynamic” answer-system once you have a few questions and answers.

@phoque: yes, you’re right. I’ll stick with static number of options for this project as this is my first project with Symphony. I might use your technique for more robust polling-system in the next projects.

I’d love to see the finished product. Especially the events (wich will be the hardest part). :-)

That way you can have as many answers as you like per question.

Yeah I thought about that initially, but then the events system would have to be much more complex because the vote counters would have to be variable too… no?

“Actual Answers” would be a section with some way of saving the users ID (must be unique to prevent multiple votes) and a select box link to the entry in “Possible Answers”.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details