I am getting above error when I run my module in browser as: 192.168.0.106/magento-2/module1/index/index
Below is my Controller code:
<?php
namespace Company1\Module1\Controller\Index;
class Index extends \Magento\Framework\App\Action\Action
{
protected $resultPageFactory;
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
)
{
## parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
}
public function execute()
{
return $this->resultPageFactory->create();
}
}
Here is the routes.xml:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
<router id="standard">
<route id="module1" frontName="module1">
<module name="Company1_Module1"/>
</route>
</router>
</config>
Module.xml
<?xml version="1.0"?>
<!--<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Company1_Module1" schema_version="1.0.0" setup_version="1.0.0"/>
</config>
And Block file:
<?php
namespace Company1\Module1\Block;
class Module1 extends \Magento\Framework\View\Element\Template
{
public function _prepareLayout()
{
return parent::_prepareLayout();
}
}
Layout file:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd" layout="3columns">
<head>
<title>Module1 Text !!!</title>
</head>
<body>
<referenceContainer name="content">
<block class="Company1\Module1\Block\Module1" name="module1" template="Company1_Module1::default.phtml"></block>
</referenceContainer>
</body>
</page>