Skip to content
This repository was archived by the owner on Jun 7, 2022. It is now read-only.

Commit 88333e9

Browse files
committed
Added first Block, template, layout
1 parent 9709cbc commit 88333e9

File tree

4 files changed

+52
-2
lines changed

4 files changed

+52
-2
lines changed

Block/Index.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* Copyright © 2017 Magefan (support@magefan.com). All rights reserved.
4+
* See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
5+
*
6+
* Glory to Ukraine! Glory to the heroes!
7+
*/
8+
9+
namespace Magefan\Faq\Block;
10+
11+
/**
12+
* Faq home block
13+
*/
14+
class Index extends \Magento\Framework\View\Element\Template
15+
{
16+
/**
17+
* Retrieve welcome text
18+
* @return string
19+
*/
20+
public function getWelcomeText()
21+
{
22+
return 'Hello World';
23+
}
24+
}

Controller/Index/Index.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class Index extends \Magento\Framework\App\Action\Action
1919
*/
2020
public function execute()
2121
{
22-
echo 'Hello World';
23-
exit();
22+
$this->_view->loadLayout();
23+
$this->_view->renderLayout();
2424
}
2525

2626
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2017 Magefan (support@magefan.com). All rights reserved.
5+
* See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
6+
*
7+
* Glory to Ukraine! Glory to the heroes!
8+
*/
9+
-->
10+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
11+
<body>
12+
<referenceContainer name="content">
13+
<block class="Magefan\Faq\Block\Index" name="faq.list" template="Magefan_Faq::index.phtml" />
14+
</referenceContainer>
15+
</body>
16+
</page>

view/frontend/templates/index.phtml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
/**
3+
* Copyright © 2017 Magefan (support@magefan.com). All rights reserved.
4+
* See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
5+
*
6+
* Glory to Ukraine! Glory to the heroes!
7+
*/
8+
?>
9+
10+
<h1><?php echo $block->escapeHtml($block->getWelcomeText()) ?></h1>

0 commit comments

Comments
 (0)