Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

How to make a rollet choose.


Reply


6 Posts   1090 Views

Avatar
t00thy

Community Member, 31 Posts

11 May 2011 at 3:23am

Hi there,

i try to make the polls module work with SS 2.4.5. I can creat the polls and answares, but i cant show the poll. I have page type ShowPoll.ss and i can choos it. But i can't choose a specific poll. I need to make something like then you choose an image to thumbnail or page to redirect.

Is there any option to make it?

Thanks

Avatar
swaiba

Forum Moderator, 1799 Posts

11 May 2011 at 4:28am

As I recall I used the polls and inserted it on the page as a widget - this was all I required - have you tried that?
I don't recall there being an entire page dedicated to it (I may have removed it myself though).

Avatar
t00thy

Community Member, 31 Posts

11 May 2011 at 7:51pm

Hi,

I try it right now. But I can't see the poll as a widget.
A attach two files. One is the screen of widget and one is the polls.

How I can add the poll to some page? I have the Poll and Answers in the database. How I can show that in the frontend?

Attached Files
Avatar
swaiba

Forum Moderator, 1799 Posts

11 May 2011 at 8:39pm

well I couldn't find anything - except the code from the old site where I used it - please find it attached here

Attached Files
Avatar
t00thy

Community Member, 31 Posts

11 May 2011 at 9:28pm

Well... Thanks so much. It works for me now.

But...

Now I need to show this widget on the different page. No only on the blog module... and I need to transform "Show Random Poll" to "Show $This Poll"

We'll see how it goes next

Avatar
swaiba

Forum Moderator, 1799 Posts

11 May 2011 at 9:40pm

After see the MASSIVE (ha ha) amounts of code in those widgets I think it is just adding the $MyPoll to the Page.ss and the frunction MyPoll to the appropriate controller.

if you want to force the poll, then modify "class ShowPoll" so that the __construct takes an ID and then uses that with a get_by_id instead of a get_one... at this point...
from...

function __construct($controller, $name)
...
$poll = DataObject::get_one('Poll', 'IsActive = 1', true, DB::getConn()->random());

to....

function __construct($controller, $name,$iPollID)
...
$poll = DataObject::get_by_id('Poll', $iPollID);