cancel
Showing results for 
Search instead for 
Did you mean: 

Custom front end page is blank

Custom front end page is blank

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!

9 REPLIES 9

Re: Custom front end page is blank

Hi @supportopeadb2 

 

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

Re: Custom front end page is blank

Hello,

There is no error message and even no content. Only html, head and body tag is loaded with blank content.

Thanks!

Re: Custom front end page is blank

Hi @supportopeadb2,

 

Can you share the code you are using?

Re: Custom front end page is blank

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!

Re: Custom front end page is blank

Hello,

Can you please share your code for routes.xml and also share the name of
the layout file which you have made inside view/frontend/layouts folder.

Thanks.

Re: Custom front end page is blank

Hi @supportopeadb2 

 

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

Re: Custom front end page is blank

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!

Re: Custom front end page is blank

Hi @supportopeadb2 

 

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

 

Re: Custom front end page is blank

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!