Templates are not working correctly
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
2
down vote
favorite
I'm attempting to create my own module with a custom template however in my browser, I am unable to view the 'hello world' output.
Gregt/Hello/block - helloworld.php
<?php
namespace GregTHelloBlock;
class Helloworld extends MagentoFrameworkViewElementTemplate
public function getHelloWorldTxt()
return 'Hello world!';
Gregt/Hello/controller/index - index.php
<?php
namespace GregTHelloControllerIndex;
use MagentoFrameworkAppActionContext;
class Index extends MagentoFrameworkAppActionAction
protected $_resultPageFactory;
public function __construct(Context $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory)
$this->_resultPageFactory = $resultPageFactory;
parent::__construct($context);
public function execute()
$resultPage = $this->_resultPageFactory->create();
echo ("hello");
return $resultPage;
Gregt/Hello/VIEW/frontend/layout - helloworld_index_index.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/
Framewo rk/View/Layout/etc/page_configuration.xsd" layout="1column">
<body>
<referenceContainer name="content">
<block class="GregTHelloBlockHelloworld" name="helloworld"
template="GregT_Hello::helloworld.phtml" />
</referenceContainer>
</body>
</page>
Gregt/Hello/etc/frontend - routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="GregT_Hello" />
</route>
</router>
</config>
Gregt/Hello/etc - module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="GregT_Hello" setup_version="1.0.0">
</module>
</config>
Gregt/Hello/view/frontend/templates - helloworld.phtml
<h1><?php echo $block->getHelloWorldTxt(); ?></h1>
Gregt/Hello - registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'GregT_Hello',
__DIR__
);
magento2 localhost
add a comment |Â
up vote
2
down vote
favorite
I'm attempting to create my own module with a custom template however in my browser, I am unable to view the 'hello world' output.
Gregt/Hello/block - helloworld.php
<?php
namespace GregTHelloBlock;
class Helloworld extends MagentoFrameworkViewElementTemplate
public function getHelloWorldTxt()
return 'Hello world!';
Gregt/Hello/controller/index - index.php
<?php
namespace GregTHelloControllerIndex;
use MagentoFrameworkAppActionContext;
class Index extends MagentoFrameworkAppActionAction
protected $_resultPageFactory;
public function __construct(Context $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory)
$this->_resultPageFactory = $resultPageFactory;
parent::__construct($context);
public function execute()
$resultPage = $this->_resultPageFactory->create();
echo ("hello");
return $resultPage;
Gregt/Hello/VIEW/frontend/layout - helloworld_index_index.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/
Framewo rk/View/Layout/etc/page_configuration.xsd" layout="1column">
<body>
<referenceContainer name="content">
<block class="GregTHelloBlockHelloworld" name="helloworld"
template="GregT_Hello::helloworld.phtml" />
</referenceContainer>
</body>
</page>
Gregt/Hello/etc/frontend - routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="GregT_Hello" />
</route>
</router>
</config>
Gregt/Hello/etc - module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="GregT_Hello" setup_version="1.0.0">
</module>
</config>
Gregt/Hello/view/frontend/templates - helloworld.phtml
<h1><?php echo $block->getHelloWorldTxt(); ?></h1>
Gregt/Hello - registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'GregT_Hello',
__DIR__
);
magento2 localhost
try with this<h1><?php echo $block->getHelloWorldTxt(); ?></h1>
â kunj
Aug 14 at 9:00
Your layout file is at wrong place I have added the answer with the correct place and content.
â kunj
Aug 14 at 9:30
Hi, Greg, welcome. You don't need to add "SOLVED" to the question, and also don't need to tag the title (the tagging system will do that for you). I've posted an edit removing those elements from the title. The stackexchange system will mark the question as solved (the green checkmark on accepted answer) and also show the main tag automatically.
â Mindwin
Aug 14 at 13:10
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'm attempting to create my own module with a custom template however in my browser, I am unable to view the 'hello world' output.
Gregt/Hello/block - helloworld.php
<?php
namespace GregTHelloBlock;
class Helloworld extends MagentoFrameworkViewElementTemplate
public function getHelloWorldTxt()
return 'Hello world!';
Gregt/Hello/controller/index - index.php
<?php
namespace GregTHelloControllerIndex;
use MagentoFrameworkAppActionContext;
class Index extends MagentoFrameworkAppActionAction
protected $_resultPageFactory;
public function __construct(Context $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory)
$this->_resultPageFactory = $resultPageFactory;
parent::__construct($context);
public function execute()
$resultPage = $this->_resultPageFactory->create();
echo ("hello");
return $resultPage;
Gregt/Hello/VIEW/frontend/layout - helloworld_index_index.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/
Framewo rk/View/Layout/etc/page_configuration.xsd" layout="1column">
<body>
<referenceContainer name="content">
<block class="GregTHelloBlockHelloworld" name="helloworld"
template="GregT_Hello::helloworld.phtml" />
</referenceContainer>
</body>
</page>
Gregt/Hello/etc/frontend - routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="GregT_Hello" />
</route>
</router>
</config>
Gregt/Hello/etc - module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="GregT_Hello" setup_version="1.0.0">
</module>
</config>
Gregt/Hello/view/frontend/templates - helloworld.phtml
<h1><?php echo $block->getHelloWorldTxt(); ?></h1>
Gregt/Hello - registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'GregT_Hello',
__DIR__
);
magento2 localhost
I'm attempting to create my own module with a custom template however in my browser, I am unable to view the 'hello world' output.
Gregt/Hello/block - helloworld.php
<?php
namespace GregTHelloBlock;
class Helloworld extends MagentoFrameworkViewElementTemplate
public function getHelloWorldTxt()
return 'Hello world!';
Gregt/Hello/controller/index - index.php
<?php
namespace GregTHelloControllerIndex;
use MagentoFrameworkAppActionContext;
class Index extends MagentoFrameworkAppActionAction
protected $_resultPageFactory;
public function __construct(Context $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory)
$this->_resultPageFactory = $resultPageFactory;
parent::__construct($context);
public function execute()
$resultPage = $this->_resultPageFactory->create();
echo ("hello");
return $resultPage;
Gregt/Hello/VIEW/frontend/layout - helloworld_index_index.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/
Framewo rk/View/Layout/etc/page_configuration.xsd" layout="1column">
<body>
<referenceContainer name="content">
<block class="GregTHelloBlockHelloworld" name="helloworld"
template="GregT_Hello::helloworld.phtml" />
</referenceContainer>
</body>
</page>
Gregt/Hello/etc/frontend - routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="GregT_Hello" />
</route>
</router>
</config>
Gregt/Hello/etc - module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="GregT_Hello" setup_version="1.0.0">
</module>
</config>
Gregt/Hello/view/frontend/templates - helloworld.phtml
<h1><?php echo $block->getHelloWorldTxt(); ?></h1>
Gregt/Hello - registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'GregT_Hello',
__DIR__
);
magento2 localhost
edited Aug 14 at 13:12
Mindwin
1031
1031
asked Aug 14 at 8:39
Greg Taylor
637
637
try with this<h1><?php echo $block->getHelloWorldTxt(); ?></h1>
â kunj
Aug 14 at 9:00
Your layout file is at wrong place I have added the answer with the correct place and content.
â kunj
Aug 14 at 9:30
Hi, Greg, welcome. You don't need to add "SOLVED" to the question, and also don't need to tag the title (the tagging system will do that for you). I've posted an edit removing those elements from the title. The stackexchange system will mark the question as solved (the green checkmark on accepted answer) and also show the main tag automatically.
â Mindwin
Aug 14 at 13:10
add a comment |Â
try with this<h1><?php echo $block->getHelloWorldTxt(); ?></h1>
â kunj
Aug 14 at 9:00
Your layout file is at wrong place I have added the answer with the correct place and content.
â kunj
Aug 14 at 9:30
Hi, Greg, welcome. You don't need to add "SOLVED" to the question, and also don't need to tag the title (the tagging system will do that for you). I've posted an edit removing those elements from the title. The stackexchange system will mark the question as solved (the green checkmark on accepted answer) and also show the main tag automatically.
â Mindwin
Aug 14 at 13:10
try with this
<h1><?php echo $block->getHelloWorldTxt(); ?></h1>
â kunj
Aug 14 at 9:00
try with this
<h1><?php echo $block->getHelloWorldTxt(); ?></h1>
â kunj
Aug 14 at 9:00
Your layout file is at wrong place I have added the answer with the correct place and content.
â kunj
Aug 14 at 9:30
Your layout file is at wrong place I have added the answer with the correct place and content.
â kunj
Aug 14 at 9:30
Hi, Greg, welcome. You don't need to add "SOLVED" to the question, and also don't need to tag the title (the tagging system will do that for you). I've posted an edit removing those elements from the title. The stackexchange system will mark the question as solved (the green checkmark on accepted answer) and also show the main tag automatically.
â Mindwin
Aug 14 at 13:10
Hi, Greg, welcome. You don't need to add "SOLVED" to the question, and also don't need to tag the title (the tagging system will do that for you). I've posted an edit removing those elements from the title. The stackexchange system will mark the question as solved (the green checkmark on accepted answer) and also show the main tag automatically.
â Mindwin
Aug 14 at 13:10
add a comment |Â
4 Answers
4
active
oldest
votes
up vote
4
down vote
accepted
Check below solution, May be helpful to you.
You have created Gregt/Hello/controller/index - index.php
And Gregt/Hello/block - helloworld.php
Also layout file wrong, It should be Gregt/Hello/view/frontend/layout - helloworld_index_index.xml
folder name should be Controller not controller, Block not block. Please correct folder name and check.
Changed all these but still isn't showing
â Greg Taylor
Aug 14 at 9:06
Also you should apply changes as per @Amit bera
â Suresh Chikani
Aug 14 at 9:18
add a comment |Â
up vote
4
down vote
You did a small mistake
<?php echo $this->getHelloWorldTxt(); ?>
Should be
<?php echo $block->getHelloWorldTxt(); ?>
Also have to change
name="helloworld"
template="helloworld.phtml"
to
name="helloworld"
template="GregT_Hello::helloworld.phtml"
I've done this but no change
â Greg Taylor
Aug 14 at 9:05
add a comment |Â
up vote
3
down vote
Controller path should be like this:
app/code/Gregt/Hello/Controller/Index/Index.php
in
execute()
try to put insidereturn "Hello";
Call this path :
domaine.com/helloworld
and see If you seeHello
Hi, I'm now able to see Hello at the top of the page.
â Greg Taylor
Aug 14 at 8:55
Did you updated the files to Capitalize letters and refreshed th cache ?
â Prince
Aug 14 at 8:59
Yes but I don't think it is using the template and instead just echoing from index.php
â Greg Taylor
Aug 14 at 9:00
Yes I mean the controller files fromapp/code/Gregt/Hello/controller/index/index.php
toapp/code/Gregt/Hello/Controller/Index/Index.php
â Prince
Aug 14 at 9:02
1
yes I knew it, I told you in the previous comment (errors in your module including the controller andlayout
) but it was necessary to debug the controller before, the essential is that you have solved your problem, good luck :)
â Prince
Aug 14 at 9:38
 |Â
show 5 more comments
up vote
2
down vote
Your lyout file should be like this:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="GregTHelloBlockHelloworld" name="helloworld"
template="GregT_Hello::helloworld.phtml" />
</referenceContainer>
</body>
</page>
And Place must be at app/code/GregT/Hello/view/frontend/layout/helloworld_index_index.xml
add a comment |Â
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
Check below solution, May be helpful to you.
You have created Gregt/Hello/controller/index - index.php
And Gregt/Hello/block - helloworld.php
Also layout file wrong, It should be Gregt/Hello/view/frontend/layout - helloworld_index_index.xml
folder name should be Controller not controller, Block not block. Please correct folder name and check.
Changed all these but still isn't showing
â Greg Taylor
Aug 14 at 9:06
Also you should apply changes as per @Amit bera
â Suresh Chikani
Aug 14 at 9:18
add a comment |Â
up vote
4
down vote
accepted
Check below solution, May be helpful to you.
You have created Gregt/Hello/controller/index - index.php
And Gregt/Hello/block - helloworld.php
Also layout file wrong, It should be Gregt/Hello/view/frontend/layout - helloworld_index_index.xml
folder name should be Controller not controller, Block not block. Please correct folder name and check.
Changed all these but still isn't showing
â Greg Taylor
Aug 14 at 9:06
Also you should apply changes as per @Amit bera
â Suresh Chikani
Aug 14 at 9:18
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
Check below solution, May be helpful to you.
You have created Gregt/Hello/controller/index - index.php
And Gregt/Hello/block - helloworld.php
Also layout file wrong, It should be Gregt/Hello/view/frontend/layout - helloworld_index_index.xml
folder name should be Controller not controller, Block not block. Please correct folder name and check.
Check below solution, May be helpful to you.
You have created Gregt/Hello/controller/index - index.php
And Gregt/Hello/block - helloworld.php
Also layout file wrong, It should be Gregt/Hello/view/frontend/layout - helloworld_index_index.xml
folder name should be Controller not controller, Block not block. Please correct folder name and check.
edited Aug 14 at 8:48
answered Aug 14 at 8:42
Suresh Chikani
9,08242564
9,08242564
Changed all these but still isn't showing
â Greg Taylor
Aug 14 at 9:06
Also you should apply changes as per @Amit bera
â Suresh Chikani
Aug 14 at 9:18
add a comment |Â
Changed all these but still isn't showing
â Greg Taylor
Aug 14 at 9:06
Also you should apply changes as per @Amit bera
â Suresh Chikani
Aug 14 at 9:18
Changed all these but still isn't showing
â Greg Taylor
Aug 14 at 9:06
Changed all these but still isn't showing
â Greg Taylor
Aug 14 at 9:06
Also you should apply changes as per @Amit bera
â Suresh Chikani
Aug 14 at 9:18
Also you should apply changes as per @Amit bera
â Suresh Chikani
Aug 14 at 9:18
add a comment |Â
up vote
4
down vote
You did a small mistake
<?php echo $this->getHelloWorldTxt(); ?>
Should be
<?php echo $block->getHelloWorldTxt(); ?>
Also have to change
name="helloworld"
template="helloworld.phtml"
to
name="helloworld"
template="GregT_Hello::helloworld.phtml"
I've done this but no change
â Greg Taylor
Aug 14 at 9:05
add a comment |Â
up vote
4
down vote
You did a small mistake
<?php echo $this->getHelloWorldTxt(); ?>
Should be
<?php echo $block->getHelloWorldTxt(); ?>
Also have to change
name="helloworld"
template="helloworld.phtml"
to
name="helloworld"
template="GregT_Hello::helloworld.phtml"
I've done this but no change
â Greg Taylor
Aug 14 at 9:05
add a comment |Â
up vote
4
down vote
up vote
4
down vote
You did a small mistake
<?php echo $this->getHelloWorldTxt(); ?>
Should be
<?php echo $block->getHelloWorldTxt(); ?>
Also have to change
name="helloworld"
template="helloworld.phtml"
to
name="helloworld"
template="GregT_Hello::helloworld.phtml"
You did a small mistake
<?php echo $this->getHelloWorldTxt(); ?>
Should be
<?php echo $block->getHelloWorldTxt(); ?>
Also have to change
name="helloworld"
template="helloworld.phtml"
to
name="helloworld"
template="GregT_Hello::helloworld.phtml"
answered Aug 14 at 8:59
Amit Beraâ¦
53.6k1366156
53.6k1366156
I've done this but no change
â Greg Taylor
Aug 14 at 9:05
add a comment |Â
I've done this but no change
â Greg Taylor
Aug 14 at 9:05
I've done this but no change
â Greg Taylor
Aug 14 at 9:05
I've done this but no change
â Greg Taylor
Aug 14 at 9:05
add a comment |Â
up vote
3
down vote
Controller path should be like this:
app/code/Gregt/Hello/Controller/Index/Index.php
in
execute()
try to put insidereturn "Hello";
Call this path :
domaine.com/helloworld
and see If you seeHello
Hi, I'm now able to see Hello at the top of the page.
â Greg Taylor
Aug 14 at 8:55
Did you updated the files to Capitalize letters and refreshed th cache ?
â Prince
Aug 14 at 8:59
Yes but I don't think it is using the template and instead just echoing from index.php
â Greg Taylor
Aug 14 at 9:00
Yes I mean the controller files fromapp/code/Gregt/Hello/controller/index/index.php
toapp/code/Gregt/Hello/Controller/Index/Index.php
â Prince
Aug 14 at 9:02
1
yes I knew it, I told you in the previous comment (errors in your module including the controller andlayout
) but it was necessary to debug the controller before, the essential is that you have solved your problem, good luck :)
â Prince
Aug 14 at 9:38
 |Â
show 5 more comments
up vote
3
down vote
Controller path should be like this:
app/code/Gregt/Hello/Controller/Index/Index.php
in
execute()
try to put insidereturn "Hello";
Call this path :
domaine.com/helloworld
and see If you seeHello
Hi, I'm now able to see Hello at the top of the page.
â Greg Taylor
Aug 14 at 8:55
Did you updated the files to Capitalize letters and refreshed th cache ?
â Prince
Aug 14 at 8:59
Yes but I don't think it is using the template and instead just echoing from index.php
â Greg Taylor
Aug 14 at 9:00
Yes I mean the controller files fromapp/code/Gregt/Hello/controller/index/index.php
toapp/code/Gregt/Hello/Controller/Index/Index.php
â Prince
Aug 14 at 9:02
1
yes I knew it, I told you in the previous comment (errors in your module including the controller andlayout
) but it was necessary to debug the controller before, the essential is that you have solved your problem, good luck :)
â Prince
Aug 14 at 9:38
 |Â
show 5 more comments
up vote
3
down vote
up vote
3
down vote
Controller path should be like this:
app/code/Gregt/Hello/Controller/Index/Index.php
in
execute()
try to put insidereturn "Hello";
Call this path :
domaine.com/helloworld
and see If you seeHello
Controller path should be like this:
app/code/Gregt/Hello/Controller/Index/Index.php
in
execute()
try to put insidereturn "Hello";
Call this path :
domaine.com/helloworld
and see If you seeHello
answered Aug 14 at 8:48
Prince
6,0512932
6,0512932
Hi, I'm now able to see Hello at the top of the page.
â Greg Taylor
Aug 14 at 8:55
Did you updated the files to Capitalize letters and refreshed th cache ?
â Prince
Aug 14 at 8:59
Yes but I don't think it is using the template and instead just echoing from index.php
â Greg Taylor
Aug 14 at 9:00
Yes I mean the controller files fromapp/code/Gregt/Hello/controller/index/index.php
toapp/code/Gregt/Hello/Controller/Index/Index.php
â Prince
Aug 14 at 9:02
1
yes I knew it, I told you in the previous comment (errors in your module including the controller andlayout
) but it was necessary to debug the controller before, the essential is that you have solved your problem, good luck :)
â Prince
Aug 14 at 9:38
 |Â
show 5 more comments
Hi, I'm now able to see Hello at the top of the page.
â Greg Taylor
Aug 14 at 8:55
Did you updated the files to Capitalize letters and refreshed th cache ?
â Prince
Aug 14 at 8:59
Yes but I don't think it is using the template and instead just echoing from index.php
â Greg Taylor
Aug 14 at 9:00
Yes I mean the controller files fromapp/code/Gregt/Hello/controller/index/index.php
toapp/code/Gregt/Hello/Controller/Index/Index.php
â Prince
Aug 14 at 9:02
1
yes I knew it, I told you in the previous comment (errors in your module including the controller andlayout
) but it was necessary to debug the controller before, the essential is that you have solved your problem, good luck :)
â Prince
Aug 14 at 9:38
Hi, I'm now able to see Hello at the top of the page.
â Greg Taylor
Aug 14 at 8:55
Hi, I'm now able to see Hello at the top of the page.
â Greg Taylor
Aug 14 at 8:55
Did you updated the files to Capitalize letters and refreshed th cache ?
â Prince
Aug 14 at 8:59
Did you updated the files to Capitalize letters and refreshed th cache ?
â Prince
Aug 14 at 8:59
Yes but I don't think it is using the template and instead just echoing from index.php
â Greg Taylor
Aug 14 at 9:00
Yes but I don't think it is using the template and instead just echoing from index.php
â Greg Taylor
Aug 14 at 9:00
Yes I mean the controller files from
app/code/Gregt/Hello/controller/index/index.php
to app/code/Gregt/Hello/Controller/Index/Index.php
â Prince
Aug 14 at 9:02
Yes I mean the controller files from
app/code/Gregt/Hello/controller/index/index.php
to app/code/Gregt/Hello/Controller/Index/Index.php
â Prince
Aug 14 at 9:02
1
1
yes I knew it, I told you in the previous comment (errors in your module including the controller and
layout
) but it was necessary to debug the controller before, the essential is that you have solved your problem, good luck :)â Prince
Aug 14 at 9:38
yes I knew it, I told you in the previous comment (errors in your module including the controller and
layout
) but it was necessary to debug the controller before, the essential is that you have solved your problem, good luck :)â Prince
Aug 14 at 9:38
 |Â
show 5 more comments
up vote
2
down vote
Your lyout file should be like this:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="GregTHelloBlockHelloworld" name="helloworld"
template="GregT_Hello::helloworld.phtml" />
</referenceContainer>
</body>
</page>
And Place must be at app/code/GregT/Hello/view/frontend/layout/helloworld_index_index.xml
add a comment |Â
up vote
2
down vote
Your lyout file should be like this:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="GregTHelloBlockHelloworld" name="helloworld"
template="GregT_Hello::helloworld.phtml" />
</referenceContainer>
</body>
</page>
And Place must be at app/code/GregT/Hello/view/frontend/layout/helloworld_index_index.xml
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Your lyout file should be like this:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="GregTHelloBlockHelloworld" name="helloworld"
template="GregT_Hello::helloworld.phtml" />
</referenceContainer>
</body>
</page>
And Place must be at app/code/GregT/Hello/view/frontend/layout/helloworld_index_index.xml
Your lyout file should be like this:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="GregTHelloBlockHelloworld" name="helloworld"
template="GregT_Hello::helloworld.phtml" />
</referenceContainer>
</body>
</page>
And Place must be at app/code/GregT/Hello/view/frontend/layout/helloworld_index_index.xml
answered Aug 14 at 9:29
kunj
2,3672420
2,3672420
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f238291%2ftemplates-are-not-working-correctly%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
try with this
<h1><?php echo $block->getHelloWorldTxt(); ?></h1>
â kunj
Aug 14 at 9:00
Your layout file is at wrong place I have added the answer with the correct place and content.
â kunj
Aug 14 at 9:30
Hi, Greg, welcome. You don't need to add "SOLVED" to the question, and also don't need to tag the title (the tagging system will do that for you). I've posted an edit removing those elements from the title. The stackexchange system will mark the question as solved (the green checkmark on accepted answer) and also show the main tag automatically.
â Mindwin
Aug 14 at 13:10