Back to Top

Start Magento2 “Hello Word” Module

Updated 27 February 2024

Note:- “Webkul” is your company name and Test is module name

Folder structure

Untitled

for hello word module

files are following

app/code/Webkul/Test/etc/config.xml

Searching for an experienced
Magento 2 Company ?
Find out More
<?xml version="1.0"?>
<config>
    <modules>
        <Webkul_Test> <!--Module discription-->
            <version>1.0.0</version>
            <active>true</active>
        </Webkul_Test>
    </modules>	
    <frontend>
     <layout>
            <updates>
                <webkul_test module="Webkul_Test">
                    <file>layout.xml</file>
                </webkul_test>
            </updates>
        </layout>
    </frontend>
</config>

app/code/Webkul/Test/Block/Hello.php

<?php
class Webkul_Test_Block_Hello extends Mage_Core_Block_Template{

}

?>

app/design/frontend/default/demo/Webkul_Test/layout.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <catalog_product_view>
	<reference name="content">
		<block type="Webkul_Test_Block_Hello" name="wk-block" template="hello.phtml" />
	</reference >
    </catalog_product_view>	
</layout>

app/design/frontend/default/demo/Webkul_Test/Hello.phtml

<?php ?>
<h2>hello new magento</h2>

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home