Guest User

Untitled

a guest
Jul 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <?xml version="1.0"?>
  2. <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
  3. <body>
  4. <referenceContainer name="content">
  5. <block class="<vendor><Module>BlockIndex" name="helloworld.index" template="helloworld.phtml" />
  6. </referenceContainer>
  7. </body>
  8. </page>
  9.  
  10. <?php
  11.  
  12. namespace <vendor><Module>ControllerIndex;
  13.  
  14. use MagentoFrameworkAppActionContext;
  15.  
  16. class Index extends MagentoFrameworkAppActionAction
  17. {
  18. protected $_resultPageFactory;
  19.  
  20. public function __construct(Context $context, MagentoFrameworkViewResultPageFactory $resultPageFactory)
  21. {
  22. $this->_resultPageFactory = $resultPageFactory;
  23. parent::__construct($context);
  24. }
  25.  
  26. public function execute()
  27. {
  28. $resultPage = $this->_resultPageFactory->create();
  29. return $resultPage;
  30. }
  31. }
  32.  
  33. <?php
  34. namespace <Vendor><Module>Block;
  35.  
  36. class Index extends MagentoFrameworkViewElementTemplate
  37. {
  38. public function getHelloWorldTxt()
  39. {
  40. return 'Hello world!';
  41. }
  42. }
  43.  
  44. <h1><?php echo $this->getHelloWorldTxt(); ?></h1>
Add Comment
Please, Sign In to add comment