Hi all
I am working with the polls module to create a poll option on my site. Currently it appears that this module wants to redirect to another page once the user votes.
What I wish it to do is remain on the same page but display a results view instead.
I have 2 chunks that seperatly display the poll and then the results.
Is there a way in the template/chunk to look for a $_GET variable such as ’voted’ and based on its presence display either the poll or results view?
i.e. it would work like this
if(voted var == ’y’)
display results view
else
display poll view
Am fairly new to the workings of modx so any opinions/help would be appreciated
Thanks in advance
A snippet at the top of the voting page is probably the best way. Something like this:
<?php
if (isset$_POST['voted'] && $_POST['voted']=='Yes')) {
$modx->sendRedirect($modx->makeURL->(##));
}
?>
Replace ## with the ID of the results page.