I just created a module and I put this in my layout file:

<?xml version="1.0"?>
<layout version="0.1.0">
        <reference name="root">
            <action method="setTemplate">
        <reference name="content">
            <block type="filteredproducts/myblock" name="myblock" template="test.phtml"/>

Now for some reason, no mather what block I put there inside my reference name="content" tag. The block is shown twice.


    echo "test";


class Brightinsight_FilteredProducts_IndexController extends Mage_Core_Controller_Front_Action

    public function indexAction()


The text shown at the page is testtest. So the content must be loaded two times for some reason I just can't seem to figure out how. Any help appreciated.

  • What does your controller code look like (Filteredproducts_IndexController::indexAction)? Maybe that can give us some better clues. – Rick Buczynski Dec 28 '14 at 1:05

Given your layout / controller combination, the only things I can think of that could cause the output to occur twice are:

  1. The page/2columns-left.phtml template renders the content block twice (or the content block and manually an instance of filteredproducts/myblock).
  2. There's an event observer than it manually rendering out the additional block.
  3. You are injecting your custom phtml file test.phtml into the layout elsewhere as well as in that layout file. Perhaps some initial debug code in one of the core layout files.
  4. Your block definition extends Mage_Core_Block_Template but has additional render code in one of the rendering methods that manually renders, but still calls the parent method.

In my case it was only additional block filled from backend (Admin Panel -> CMS -> Pages -> Content)

Your Answer

