I've created a custom theme: app/design/frontend/TestVendor/testTheme with registration.php and theme.xml files.

Inside the testTheme folder I've created another folder: TestFolder and inside this folder another 2 folders and files inside them:

  1. TestFolder/layout/default.xml
  2. TestFolder/templates/mainpage.phtml

This is how the structure looks like:


This is how default magento html skeleton looks like: enter image description here

I want to add a new content inside the div element with the class name of "column main". I searched and this html was defined in vendor/magento/module-theme/view/base/page_layout/empty.xml as the container tag with the name of "main"

So I just did 2 things:

  1. added html tags with texsts to templates/mainpage.phtml.
  2. configured the layout/default.xml file and applied the theme to the website

This is how my default.xml file looks like:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceContainer name="main">
        <block class="Magento\Framework\View\Element\Template" name="slide" template="TestFolder::mainpage.phtml"/>

But mainpage.phtml content is not being rendered inside the "column main" div element. Am I doing something wrong? Any kind of help would be apreciated

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.