• Magento
  • Custom Template
  • Poll works fine when in sidebar
  • Poll works fine when loaded by layout xml


Based on this information:




I'd like to show the polls module anywhere I like, using the WYSIWYG Editor.

When I add the poll on a CMS page, by adding the xml to the design tab of the new page, it all works fine. This is not available in a static CMS Block. Since I need the poll to appear in a static block, I run into a little problem.

The problem

Loading the Poll with

{{block type="poll/poll" template="poll/active.phtml" poll_id="1"}} {{block type="poll/poll" template="poll/result.phtml" poll_id="1"}}

does indeed show the poll and the results. Of course, the appear both at the same time and the results are empty.

Attempt for a solution

I tried to emulate the way the template is changed, when it's done with xml. So I created poll/anywhere.phtml like this:

    $pollId = $this->getPollId();
    $poll = $this->getLayout()->createBlock('poll/activePoll');
    $poll->setPollTemplate('poll/result.phtml', 'results');
    $poll->setPollTemplate('poll/active.phtml', 'poll');
    echo $poll->toHtml();

Then I load This template in the WYSIWYG Editor via:

{{block type="page/html" template="poll/anywhere.phtml" poll_id="2"}}

This leads to the same behaviour, as when I load both parts separately, only that the poll itself does not show (correct in this case), but the results are still empty.

Again, when I load it with xml, it works as expected.

For reference (from the first link), this look like this:

<reference name="content">
    <block type="poll/activePoll" name="custom.poll">
        <action method="setPollId">
        <action method="setPollTemplate">
        <action method="setPollTemplate">

From What I see, the same thing should be accomplished in anywhere.phtml

The question

Is obviously, what did I do wrong, what did I miss?

Any insight is greatly appreciated.

1 Answer 1


Allow block in whitelist in admin-> system-> permission-> blocks-> add new block

Enter "poll/poll" in Block name and "Yes" in Is Allowed it should resolve your issue when you use poll/anywhere.phtml - template

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.