I created a custom module.I want to get the updated details to a front-end page from back-end.
My routes.xml file is - (Ayakil\Bannermanager\etc\frontend)
... <router id="standard"> <route id="homebanner" frontName="homebanner"> <module name="Ayakil_Bannermanager" /> </route> </router> ... Layout file is homebanner_index_index.xml - (Ayakil\Bannermanager\view\frontend\layout)
<?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">e <body> <referenceContainer name="content"> <block class="Ayakil\Bannermanager\Block\Index\Index" name="homebanner" template="Ayakil_Bannermanager::bannermanager.phtml" /> </referenceContainer> </body> </page> Template file is bannermanager.phtml - (Ayakil\Bannermanager\view\frontend\templates)
<h1><?php echo $this->getHomepageBanners(); ?></h1> Block file Index.php - (Ayakil\Bannermanager\Block\Index)
<?php namespace Ayakil\Bannermanager\Block\Index; class Index extends \Magento\Framework\View\Element\Template { protected $_bannersFactory; public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Ayakil\Rewardpoints\Model\BannersFactory $bannersFactory, array $data = array() ) { $this->_bannersFactory = $bannersFactory; parent::__construct($context, $data); } protected function _prepareLayout() { return parent::_prepareLayout(); } public function getHomepageBanners(){ $Banners = $this->_bannersFactory->create(); $collection = $Banners->getCollection(); $collection->addFieldToFilter('banner_location',1); $collection->addFieldToFilter('banner_active',1); return $collection->setOrder('id','DESC'); }//End of function getHomepageBanners }//End of class Controller file Index.php - (\Ayakil\Bannermanager\Controller\Index)
<?php namespace Ayakil\Bannermanager\Controller\Index; use Magento\Framework\View\Result\PageFactory; use Magento\Framework\App\Action\Context; class Index extends \Magento\Framework\App\Action\Action { protected $_resultPageFactory; public function __construct(Context $context, PageFactory $resultPageFactory) { $this->_resultPageFactory = $resultPageFactory; parent::__construct($context); } public function execute() { $resultPage = $this->_resultPageFactory->create(); return $resultPage; } } Here i if i type the url its comes to controller, but block file is not reaching.What is my issue in my layout file?
UPDATE
I am getting this error in system.log file
[2017-10-31 06:09:36] main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_49616ea6e172f105633873ece31b228de and handles default, homebanner_index_index: Please correct the XML data and try again. [] []