i’m new at magento 2 and i want to add some simple html to my header but i cant get to work, i have a simple theme that overrides blank theme from magento and i create the folder Magento_Theme and also this simple default.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configration.xsd">
<referenceContainer name="header.panel"> <!-- the name of the container you want to insert into -->
<container name="new_container" htmlClass="container_css_class" htmlTag="div">
<block class="MagentoFrameworkViewElementTemplate" template="Magento_Theme::template/template.phtml" name="block_name" />
</container>
</referenceContainer>
</page>
and i have this simple template in the folder Magento_Themetemplatetemplate.phtml
<div class="block" style="float: right;">
<?php echo __('Custom Line'); ?>
</div>
but the magento keep firing this error
1 exception(s):
Exception #0 (MagentoFrameworkExceptionValidatorException): Invalid
template file: 'Magento_Theme::template/template.phtml' in module: ''
block's name: 'block_name'
im using magento 2.2.5
2
Answers
I found the error the Magento_Theme:: is a path to templates folder and when i changed my template.phtml for the folder templates and change Magento_theme::template/template.php to Magento_theme::template.php it worked
Try rename your folder ‘template’ to ‘templates’ (add ‘s’) and make it like this
template=”Magento_Theme::template.phtml”