Hello,
We have mainly followed the guide https://www.mageplaza.com/magento-2-module-development/how-to-create-controllers-magento-2.html and also checked some other sites but our front end page is blank with no errors. So can some one suggest the possible solution or some other better tutorial links to follow.
Thanks!
Can you please check the console on the frontend if it showing some error or if possible share some snapshots so that we can suggest you accordingly.
Thanks
Hello,
There is no error message and even no content. Only html, head and body tag is loaded with blank content.
Thanks!
Hello,
The code is completely same as https://www.mageplaza.com/magento-2-module-development/how-to-create-controllers-magento-2.html. So please check it once.
Thanks!
Have you created the module before copying this code as they have shared the code just for the controller, not for the module.
So if you have not created a module then create one by adding registration.php and module.xml file and after that run the below command and check the result.
php bin/magento setup:upgrade
Hope it helps!
Thanks
Hello,
We have already created the module successfully and module setting page at admin side is working properly. We are using below code in front end routes.xml file
<?xml version="1.0" ?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="standard"> <route frontName="test" id="test"> <module name="Demo_Test"/> </route> </router> </config>
Layout File name is test_index_index.xml. Please check the code and suggest us accordingly.
Thanks!
Can you share filenames and locations which you have created for this custom controller.
It looks like there might be some issue in the naming configuration.\
Thanks
Hello,
We have created below files as mentioned in that tutorial. Please check them:
app/code/Demo/Test/etc/frontend/routes.xml
app/code/Demo/Test/Controller/Index/Index.php
app/code/Demo/Test/view/frontend/layout/test_index_index.xml
app/code/Demo/Test/Block/Index.php
app/code/Demo/Test/view/frontend/templates/index.phtml
Thanks!