XML – How to Display a Block in Frontend

xml

In the image below you can see the structure of my module:

enter image description here

This is the content of Block/Product/View.php:

  <?php

    class NetGroup_Attributegrouping_Block_Product_View extends Mage_Core_Block_Template
    {
        function _construct(){

             $this->setTemplate('netgroup/attributegrouping/list.phtml');
        }
         function indexAction(){
               $this->setTemplate('netgroup/attributegrouping/list.phtml');
         }
    }

This is the content of etc/config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <Netgroup_Attributegrouping>
            <version>1.0.0</version>
        </Netgroup_Attributegrouping>
    </modules>

    <global>
        <blocks>
            <netgroup_attributegrouping>
                <class>Netgroup_Attributegrouping_Block</class>
            </netgroup_attributegrouping>
        </blocks>

        <helpers>
            <netgroup_attributegrouping>
                <class>Netgroup_Attributegrouping_Helper</class>
            </netgroup_attributegrouping>
        </helpers>
    </global>

    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <netgroup_attributegrouping after="Mage_Adminhtml">Netgroup_Attributegrouping_Adminhtml</netgroup_attributegrouping>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>

    <adminhtml>
        <layout>
            <updates>
                <netgroup_attributegrouping>
                    <file>netgroup_attributegrouping.xml</file>
                </netgroup_attributegrouping>
            </updates>
        </layout>
    </adminhtml>

    <frontend>
        <layout>
            <updates>
                <netgroup_attributegrouping>
                    <file>netgroup_attributegrouping.xml</file>
                </netgroup_attributegrouping>
            </updates>
        </layout>
    </frontend>

</config>

In the design/frontend/netlogiq/default/layout/netgroup_attributegroping.xml content is:

<?xml version="1.0"?>
<layout>

    <catalog_product_view>

        <reference name="product.info">
            <block type="netgroup_attributegrouping/product_view" ></block>
        </reference>

    </catalog_product_view>

</layout>    

In the design/frontend/netlogiq/default/template/netgroup/attributegrouping/list.phtml content is:

<?php 

    echo 111111111111;

?>

AND finally in the app/design/frontend/netlgiq/default/template/catalog/product/view.phtml i have :

<div class="TEST"> TEST<br>
     <?php echo $this->getChildHtml('netgroup_attributegrouping'); ?>
</div>

I want to display my product in catalog/product/view.phtml. It does not display "1111111111" . I know there is a lot of mistakes, but what should i do , to make my module to work ? thx

Best Answer

    <reference name="product.info">
                <block type="netgroup_attributegrouping/product_view" name="netgroup_attributegrouping" as="netgroup_attributegrouping"></block>
            </reference>

then this will work `<?php echo $this->getChildHtml('netgroup_attributegrouping'); ?>`
Related Topic