1

I am new to magento. I created a block to place this block in all pages, but this is showing double time in home page.

below is my code

//local.xml

</block> </reference> </catalog_catagory_default> -->

<page_one_column translate="label">
    <reference name="right">
        <block name="mtb.template" type="core/template" template="page/mtb/mytemplate.phtml"></block>
    </reference>
</page_one_column>

<page_empty translate="label">
    <reference name="right">
        <block name="mtb.template" type="core/template" template="page/mtb/mytemplate.phtml"></block>
    </reference>
</page_empty>

<page_three_columns translate="label">
    <reference name="right">
        <block name="mtb.template" type="core/template" template="page/mtb/mytemplate.phtml"></block>
    </reference>
</page_three_columns >

<page_two_columns_left translate="label" >
    <reference name="right">
        <block name="mtb.template" type="core/template" template="page/mtb/mytemplate.phtml"></block>
    </reference>
</page_two_columns_left>

and //catalog.xml

<reference name="left">
            <block name="mtb.template" type="core/template" template="page/mtb/mytemplate.phtml"></block>
</reference>

<reference name="right">
          <block name="mtb.template" type="core/template" template="page/mtb/mytemplate.phtml"></block>
</reference>

my block is

enter image description here

can any one tell me where i went wrong?

if my block show in all pages what I can do?

thanks in advance.

1

All you need to do is add this to only one of your layout files.

<default>
    <reference name="left">
        <block name="mtb.template.left" type="core/template" template="page/mtb/mytemplate.phtml" />
    </reference>
    <reference name="right">
        <block name="mtb.template.right" type="core/template" template="page/mtb/mytemplate.phtml" />
    </reference>
</default>

But in case you have a page with the layout 3columns the block will appear bot on the left and right column. For that you need to remove one of them. You can do it like this.

<page_three_columns translate="label">
    <remove name="mtb.template.right" /><!-- or "mtb.template.left"-->
</page_three_columns>

To remove it from a page do this:

<catalog_category_view>
    <remove name="mtb.template.right" /><!-- or "mtb.template.left"-->
</catalog_category_view>
  • hi marius, now not displaying duplicates in home page, but in products view page displaying duplicates even though i wrote the <catalog_catagory_default translate="label"> <remove name="mtb.template.right"></remove> </catalog_catagory_default> the url is localhost/magento/index.php/apparel/shoes.html Can you tell me where i went wrong? – Manoj Kumar Sep 26 '13 at 7:11
  • You mean is duplicated on the same side? or one on the left and one on the right? – Marius Sep 26 '13 at 7:20
  • yes, but not in home page. showing another page(catalog) – Manoj Kumar Sep 26 '13 at 7:30
  • "Yes" what? You get one on the left and one on the right? Or both on the left? – Marius Sep 26 '13 at 7:32
  • yes, I get one on the left and one on the right. – Manoj Kumar Sep 26 '13 at 7:42

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.