Q: Proper code how to display advanced poll from node?
| Project: | Advanced Poll |
| Version: | 5.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Jump to:
I am working on integrating Advanced Poll, but extensive research of the Adv. Poll issues has proven fruitless into making it work.
I am using the following code I found here :
[code]
$node = node_load('114');
$node->teaser = $content;
unset($node->title);
print "Your vote:";
print node_view($node, $teasers, false, $links);
$output = theme('advpoll_results', check_plain($node->title), $results['results'], $results['votes'], $node->links, $node->nid, $node->voted, $node->cancel_vote);
[/code]
What happens with this code is that the vote doesn't get registered on certain computer figurations, they are thanked for the vote, but even after a refresh, the results do not show up. I am using version 5.x-1.x.-dev.
Before I do further debugging, I want to make sure I am using the preferred code to display a poll. Thanks for any help!

#1
I have no idea what you mean, please elaborate.
#2
Well, what I want to do is display a poll I made. I need the code for this. I grabbed the code I posted earlier from these threads but it doesn't work and I am sure I am doing something wrong.
I would be grateful if you could post the code you use to display an advanced poll. This may be code you use in a block, or code you can use in a say a node-frontpage.tpl file...
I hope I explained myself better this time, and thank you for any reply.
#3
The issue with advpoll is that the way poll form is loaded isn't very useful outside of the normal drupal scope. What should happen is a new function added that handles loading up the poll form (css, js, and the form itself) that way it can be reused in not so typical scenarios.
Anyways, this should do what you need, but it's still not the ideal solution:
$poll = advpoll_view($node, FALSE, TRUE);print $poll->content['poll']['#value'];
#4
Thank you very much for your reply, I will try this out ASAP. From what I understand it would be great if a function would be added for easy of use outside a node.
#5
Maybe something like:
<?phpnode_view(node_load($node->nid), FALSE, TRUE);
?>
Where $node->nid is nid of node to load.
#6
I used this:
<div style="margin-left: auto; width: 240px; margin-right: auto"><?php
print node_view(node_load(array('nid' => 436)), 1);
?>
</div>
Replace 436 with the nodeid of your poll. Make sure to use PHP code as your input format.