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

Commit

Permalink
Added first Block, template, layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ihorvansach committed Aug 27, 2017
1 parent 9709cbc commit 88333e9
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
24 changes: 24 additions & 0 deletions Block/Index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* Copyright © 2017 Magefan ([email protected]). All rights reserved.
* See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
*
* Glory to Ukraine! Glory to the heroes!
*/

namespace Magefan\Faq\Block;

/**
* Faq home block
*/
class Index extends \Magento\Framework\View\Element\Template
{
/**
* Retrieve welcome text
* @return string
*/
public function getWelcomeText()
{
return 'Hello World';
}
}
4 changes: 2 additions & 2 deletions Controller/Index/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class Index extends \Magento\Framework\App\Action\Action
*/
public function execute()
{
echo 'Hello World';
exit();
$this->_view->loadLayout();
$this->_view->renderLayout();
}

}
16 changes: 16 additions & 0 deletions view/frontend/layout/magefan_faq_index_index.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © 2017 Magefan ([email protected]). All rights reserved.
* See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
*
* Glory to Ukraine! Glory to the heroes!
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Magefan\Faq\Block\Index" name="faq.list" template="Magefan_Faq::index.phtml" />
</referenceContainer>
</body>
</page>
10 changes: 10 additions & 0 deletions view/frontend/templates/index.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
/**
* Copyright © 2017 Magefan ([email protected]). All rights reserved.
* See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
*
* Glory to Ukraine! Glory to the heroes!
*/
?>

<h1><?php echo $block->escapeHtml($block->getWelcomeText()) ?></h1>

0 comments on commit 88333e9

Please sign in to comment.