This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Setup & design » Request: how to place a poll on my site

Request: how to place a poll on my site

Request: how to place a poll on my site

Friday 15 October 2004 1:40:30 pm - 14 replies

I searched the documentation and the forums, but I can't figure out how to place a poll on my site. I'm using version 3.3-4 (3.3 release 4), and don't have the option to upgrade to 3.4 (which I heard has the option to include a poll-package).
I've visited some ezpublish sites who do have a poll system, so I'm thinking it's possible.
Just missing some documentation here =). Anyone kind enough to start the documentation on polls by answering my question?


Saturday 16 October 2004 12:12:19 pm

I had the similar problem, but I have solved it just now (I think) %]

My roadmap:

1) I have seen templates for forum, polls, etc. in setup\templates page and there are mentioned such classes as forum, poll & others. But in setup\classes there are no such classes therefore I can't create new content objects for them...
2) But also I can't see such functions as "register" or "switch on" forum, poll, etc. which must be in setup\packages page (as I thought).
3) So I do: <b>go to setup\packages, select addons item in list, select necessary addon, uninstall it and then install again</b>. And that's all - it works %]

Modified on Saturday 16 October 2004 12:50:30 pm by Andrei Barhatov

Monday 18 October 2004 7:20:34 am

Hi Andrei,

Thanks for replying. I'm feeling really stupid right now, but I still can't figure it out.
When I go to setup/packages/ all I can do is either 'import package' or 'create package'. When I click 'import package', I have to browse to a package file that I don't have (the poll), so that's not working. When I click 'create package', I can create packages with the classes that are already there (which makes sense), but poll isn't one of them.

When I go to kernel/setup/packages/ I don't see a poll package, just polls that are part of the news and blog packages. Do I have to import one of these packages to get the poll functionality? And what happens to the rest of my database when I import?

TIA for any answers given,


Monday 18 October 2004 8:04:03 am

Poll package is in ez/packages/addons/poll.

If "poll" class is not visible you should: in admin interface go to setup/packages, <b>select "addons" store from list</b>, select "poll" package from list and then deinstall it (if installed) and install again.

Modified on Monday 18 October 2004 8:04:24 am by Andrei Barhatov

Monday 18 October 2004 8:35:23 am

Hi Andrei,

Since I don't have the options you described, I'm thinking you're working with a different version of EZPublish. I'm working with version 3.3-4 (3.3 release 4), and don't have the opportunity to upgrade. So I'm looking for a poll package for this version.


Tuesday 19 October 2004 11:10:52 am


Four steps to set a poll for 3.3:
1. Create poll class 'poll' which has at least datatype 'option' and this datatype should be information collector.

2. Create an content object of class 'poll', set your options there.

3. Edit/Override collect.ini, uncomment TypeList[poll]=poll

4. Override result template design/standard/templates/content/datatype/result/count/ezoption.tpl ( optional )

Hope it helps!


Tuesday 19 October 2004 4:01:35 pm

I'm beginner at ezp... what is <b>information collector</b>? I've seen such checkbox in definition of attributes, but what does it mean?

Wednesday 20 October 2004 12:10:01 pm


Documentation about information collector can be found here


Friday 22 October 2004 8:47:29 am

Hi Wenyue,

Thanks for the help, I'm almost there! I just got one more question.
I'm placing the poll as an inline element on my homepage. When someone votes, I'd like to redirect to the homepage (have changed the settings in collect.ini to do this). Then I'd have to detect if this person has voted, so I can show the results instead of the poll.
How do I detect if someone has voted?


Friday 22 October 2004 8:55:42 am

O, and (since I can't seem to edit my previous post) how do I keep anonymous users from voting more than once?


Friday 22 October 2004 8:58:30 am


I clicked "keep me updated" and since now i can edit your posts oO

Could somebody repair this?


Friday 22 October 2004 9:01:35 am

Sorry for duble posts, but everything is all right now

Strange thing

Friday 22 October 2004 9:39:52 am

Hi Vivienne,

To disable multiple votes, you can set CollectionUserDataList[poll] to 'unique' in collect.ini.

To detect whether or not a user has voted is a bit harder. I only know how can find that in php code

$collection =& eZInformationCollection::fetchByUserIdentifier( eZInformationCollection::currentUserIdentifier(), $object->attribute( 'id' ) );
if ( $collection )
    print( "user has voted" );
    print( "user has not voted" );


Friday 22 October 2004 1:16:36 pm

Hi Wenyue,

I'm completely happy now =). I didn't get the result on the homepage to work. I tried to use an external script to determine whether someone had voted already, but kept getting the error 'Cannot instantiate non-existent class: ezinformationcollection', even though I included the script from 'kernel/classes/ezinformationcollection.php'. So I settled for a seperate resultpage, which doesn't look too bad.

For anyone else who has the same question as I did, an overview of the steps I took (with thanks to Wenyue):

1. Create a 'Poll' class with at least a datatype 'Option' (check information collector)

2. Give anonymous users read-rights to this class

3. Create a content object with class 'Poll' and set your options

4. Override collect.ini(.append.php), in my case I used the following settings:
- TypeList[poll]=poll
- SendEmail=disabled
- DisplayList[poll]=result
- CollectAnonymousData=enabled
- CollectAnonymousDataList[poll]=enabled
- CollectionUserDataList[poll]=unique

5. Override the necessary templates. I used override templates for:
- full_class_poll.tpl (node/view)
- radiobutton layout in pollpage (content/datatype/collect/ezoption.tpl)
- resultpage (content/collectedinfo/poll.tpl)
- result imagebars (content/datatype/result/count/ezoption.tpl)

6. Set the override templates in override.ini.append.php

7. Tada!

Other comments:
- I added a 'visible' flag to my 'Poll' object, which I use to determine if a poll is still active.
- My version of Mozilla Firefox did not show the result imagebars. This was because in the default template, the '#' was missing before the backgroundcolor attribute of the table cell.

Thanks to all your help!

Monday 25 October 2004 8:21:42 am

Hello (peeks head around corner)...?
I was a bit too enthousiastic in my last post, as I found another question...
If I allow anonymous users to vote, how do I prevent a user to vote more than once? With the configuration I showed in the last post, I can vote, but my colleague on the other computer (at another location and ip-address) gets the message that he already voted.
For now, I replaced 'CollectionUserDataList[poll]=unique' with 'CollectionUserDataList[poll]=multiple', but I would like some check to exists. Is there such a thing?


Modified on Tuesday 26 October 2004 12:50:57 pm by Vivienne van Velzen


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from