Jump to:

10848 Posts in 2516 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » How to make a rollet choose.

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1011 Views
  • t00thy
    Avatar
    Community Member
    31 Posts

    How to make a rollet choose. Link to this post

    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

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: How to make a rollet choose. Link to this post

    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).

  • t00thy
    Avatar
    Community Member
    31 Posts

    Re: How to make a rollet choose. Link to this post

    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
  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: How to make a rollet choose. Link to this post

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

    Attached Files
  • t00thy
    Avatar
    Community Member
    31 Posts

    Re: How to make a rollet choose. Link to this post

    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

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: How to make a rollet choose. Link to this post

    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);

    1011 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.