2

I am trying to change content blocks template, but I couldn't.

My xml is:

<reference name="content">
    <action method="setTemplate"><template>page/template.phtml</template></action>
</reference>

what is wrong with this xml.

1 Answer 1

3

You cant call setTemplate method on content block.content block is of type core/text_list.modify your code like this.

<reference name="content">
    <block type="core/template" name="{YOUR_BLOCK_NAME}" template="template.phtml />
</reference>

you should call this block with <?php echo $this->getChildHtml("{YOUR_BLOCK_NAME}") . or you can add ouput="toHtml" to the block defintion.like this.

<reference name="content">
    <block type="core/template" name="{YOUR_BLOCK_NAME}" template="template.phtml output="toHtml"/>
</reference>
2
  • Whats the use of output="toHtml"? Mar 10, 2015 at 11:51
  • if you use output="toHtml. you dont have to call this block from phtml file. Mar 10, 2015 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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