Edit: Slightly better understood
If I attempt to load my block from inside the module's default.xml it doesn't work, if I load it from Magento_Theme's default.xml layout file then it appears on the page?
Edit: I have it working but don't know why.
It depends on the container. If I reference a container and then add my block inside that it displays.
If I place my block just in it does not display.
All of the following paths are in the app/code directory.
I simply want to display my template file on the page, and it isn't showing. The module is enabled, cache cleared, grunt clean... still nothing.
Template: Website/Product/view/frontend/templates/phtml/header.phtml
Template file content:
<div>
<p>Testing, testing, testing</p>
</div>
Layout file: Website/Product/view/frontend/layout/default.xml
Layout file content:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<block class="Magento\Framework\View\Element\Template" name="webproduct" template="phtml/header.phtml"/>
</body>
</page>
Website/Product/etc/module.xml
Content:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Website_Product" setup_version="2.0.0">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</module>
</config>
Website/Product/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Website_Product',
__DIR__
);
Things I've tried:
replacing template="phtml/header.phtml" with template="Website_Product::phtml/header.phtml" in layout.xml
template="phtml/header.phtml"
withtemplate="Elcometer_Product::phtml/header.phtml"
?