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

Poll module


Reply


8 Posts   1239 Views

Avatar
Mackodlak

Community Member, 95 Posts

8 July 2011 at 1:41am

Hi, I am using this module, and I think I'm satisfied by it, but is there a way to write my own template for showing the poll?
I couldn't figure it out on my own, so I guess it isn't rly as trivial... or is it?

Avatar
Willr

Forum Moderator, 5513 Posts

10 July 2011 at 5:47pm

Well the template is pretty basic - https://github.com/mateusz/silverstripe-polls/blob/master/templates/PollForm.ss. That is trival to customize (just copy to your theme).

However I imagine you want to alter the form html inside that (which comes from $DefaultForm) which is a little tricker to alter. The form already has its own class setup 'PollForm' (https://github.com/mateusz/silverstripe-polls/blob/master/code/PollForm.php) so you just need to define a PollForm.ss template

This documentation page shows how to have a custom form template - http://doc.silverstripe.org/sapphire/en/topics/forms#using-a-custom-template.

Avatar
Mackodlak

Community Member, 95 Posts

12 July 2011 at 2:11am

Thanks, I think I understand what needs to be done and will try it out today/tomorrow.
Thank you, if i have further troubles I will ask again here.

Avatar
Mackodlak

Community Member, 95 Posts

12 July 2011 at 8:43pm

Well tbh I am still not sure where/how to do this.
I have included the wanted template (I hope in full) in the attachment. can someone plz help with including it into pollmodule?

Attached Files
Avatar
Mackodlak

Community Member, 95 Posts

14 July 2011 at 1:50am

Has any1 tried making a custom PollForm.ss?

Avatar
Mackodlak

Community Member, 95 Posts

19 July 2011 at 7:34pm

Could rly use some more help with this.
bump

Avatar
Willr

Forum Moderator, 5513 Posts

19 July 2011 at 7:41pm

What you want to do is copy the default 'Form.ss' template (sapphire/templates or on that wiki page) and make a PollForm.ss file in your theme - themes/yourtheme/templates.

You can then customize that PollForm.ss template as you wish, remembering to use ?flush=1 when you view your changes on the site to ensure the templates are refreshed.

Somethings you won't be able to customize (like individual form fields) easily as these come from the PHP files.

Avatar
Mackodlak

Community Member, 95 Posts

20 July 2011 at 12:58am

Edited: 20/07/2011 12:59am

Hey mate, it seems it's not all about PollForm.ss
I was looking at the form for a few days now, trying to make it and I failed, but then I figured it out. It is kinda messy, but you have to change /polls/css/ShowPoll.css if you wish to make anything out of it.
I still don't know where to change one thing : radio buttons (or checkboxes) . I have my own box (class "radio") with a bit of javascript that I have to implement, but tbh don't know where to do it.
I won't mind if it's a global change (for everything, not only pollform) since it's the detail they want to use.
In any case Willr thank you for helping me, I eventually found where the change needs to be done.