2

Magento has released new version 2.0. I am trying to creating HelloWorld Module in Magento 2.0 . I have created controllers which is working fine. But I am having issue with displaying block in content area. Below is my code :

Excercise\HelloWorld\Block\HelloWorld.php

<?php
 namespace Excercise\HelloWorld\Block;
 class HelloWorld extends \Magento\Framework\View\Element\Template
 {}
?>

Excercise\HelloWorld\view\frontend\layout\helloworld_index_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Lay   out/etc/page_configuration.xsd">
<body>
    <referenceContainer name="content">
        <block class="Excercise\HelloWorld\Block\HelloWorld" name="helloworld" template="helloworld.phtml" />
    </referenceContainer>
</body>
</page>

Excercise\HelloWorld\view\frontend\template\helloworld.phtml

<h1>Welcome to Magento2 !</h1>

Please help me out to solve this issue.

3

0

Browse other questions tagged or ask your own question.