Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
$305 per month—let's make that $500!Learn more
With this snippet you're able to create a view for the poll questions and answers wich you have created in the manager. You can create two pairs of chunks; one pair of two chunks for the voting form and one pair of two chunks for the result view after you voted. Read down below how the templates are working and see what parameters could be set.
The PollsLatest snippet can be used simple putting this tag in your template or resource content
For parameter usage, please see the table below
|tplVote||The main form template for the latest poll view||pollsLatestVoteOuter|
|tplVoteAnswer||The form template for the answers inside the main view||pollsLatestVoteAnswer|
|tplResult||The main result template for the latest poll view||pollsLatestResultOuter|
|tplResultAnswer||The result template for the answers inside the outer view||pollsLatestResultAnswer|
|category||(Optional) Will select the latest poll from the given category (id). Could be multiple by given a comma seperated list of category ids|
|sortby||(Optional) To influence the normal order, order could be any field in list||id|
|sortdir||(Optional) to influence the normal order direction||DESC|
Note: the sort options are normally not need to change!
|resultResource||(Optional) When set to a resource id, this resource will be used to show the poll results|
|resultLinkVar||(Optional) When using resultResource, this is the parametername the snippet is looking for||poll|
Within the templates for this snippet you can use the following placeholders to generate your view.
||The question id of the current poll view|
||The question text|
||The publishdate of the question|
||The unpublishdate of the question|
||The total number of votes on this poll|
||The name of the poll category (only availbale when using the category property)|
||The URL of the results view (only available when using the resultResource property)|
||Contains the output of the answers generated for this poll question|
||The id of the answer record|
||The loop number of the answers list (start: 1)|
||The answer text|
||The number of votes for this answer|
||The percentage of the number of votes for this answer|
Note: for the results view of this snippet, the same placeholders as above are available, including this extra one.
||The datetime of the vote of the current visitor (based on IP address)|
The default call of this snippet returns a basic view of the poll-vote and poll-results. You can change above parameters to create your own (also possible by propertysets).
[[!PollsLatest? &tplVote=`myVoteOuter` &tplVoteAnswer=`myVoteAnswer`]]
To select the latest poll from a category, specify the category parameter
Selecting latest questions from multiple given id's