0

I would like to know how to find the block type of some page example : the home page.

I have a problem in my homepage, I want to display some block, in the xml I declared my block in <cms_index_index> (local.xml) but if I put it in the <reference name="head"> it appears, if <reference name="content"> or <reference name="content"> it does not work . It seems to me that the type of block is not good.

xml:

<cms_index_index>
        <reference name="root">
            <block type="core/template" name="seconnecter_test" template="customer/form/test-seconnecter.phtml"/>
        </reference>
</cms_index_index>

in the homepage 1column-full.phtml i called it like this:

<?php echo $this->getChildHtml('seconnecter_test');?>

i have tested to add output="toHtml", it works but it displays me the block at the bottom of a footer, i want to display it in the place where i called getChildHtml.

2
  • provide your phtml code Commented Dec 29, 2016 at 2:42
  • i have found a solution, i called my block as getBlockhtml('seconnecter_test') and it works, i dont know why getChildHtml dont work !
    – PЯINCƎ
    Commented Dec 29, 2016 at 8:29

2 Answers 2

0

please add xml as below in local.xml

<cms_index_index>
        <reference name="content">
            <block type="core/template" name="seconnecter_test" template="customer/form/test-seconnecter.phtml"/>
        </reference>
</cms_index_index>

Select template for your home page 1column-full.phtml

FYI: type in block tag is block class, if it's core/template then Mage_Core_Block_Template

2
  • it will add the block to the bottom of the content because 'content' is core/text_list block. replace content with root and it should work. Commented Dec 16, 2016 at 10:19
  • <reference name="content"> and <reference name="root"> doesn't work but <reference name="head"> work but i dont want to dsplay it in header. output="toHtml" display it at the bottom with reference="root", i tryed to move it at the top with before="content" but its not working
    – PЯINCƎ
    Commented Dec 16, 2016 at 11:23
0

If you know about block type, please check bellow the example for how to find proper block type.

<cms_index_index>
    <reference name="content">
        <block type="modulename/blockname" name="seconnecter_test" template="customer/form/test-seconnecter.phtml"/>
    </reference>

in this example, if you need specific block file for calling phtml in any page then check this, modulename/blockname so you find this block in your custom module path Namespace_Modulename_Block_Blockname.

if you used core/templete then this core template so you can call any phtml file using core block type.

Your Answer

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

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