Question

I am building out a new page. I have tried cache:clean, removing the files from var cache/generation/page_cache myself and setup:upgrade. Still shows up blank. I am getting an error in my XML file that 'Element referenceContainer is not allowed here' and 'Can not resolve symbol referenceBlock'. I am lost! Any help would be great!

edit: I also have page cache disable in the admin system. Using PHPstorm 2017.1

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceContainer name="content">

    <referenceblock template="content.phtml"
                    class="Blank\HelloWorld\Block\Main"
                    name="blank_helloWorld" />

</referenceContainer>

I also have a content.phtml page

<h1> Hello </h1>
Was it helpful?

Solution

Change your layout config by:


<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Blank\HelloWorld\Block\Main" name="blank_helloWorld" template="Blank_HelloWorld::content.phtml" />
        </referenceContainer>
    </body>
</page>

Clear cache.

OTHER TIPS

Replace your layout as suggested by Sohel Rana and then print something in your template file.

Do not forget to cache:flush or cache:clean every time when you change in layout file.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top