here my default.xml

    <referenceContainer name="header-wrapper">
       <block class="Magento\Framework\View\Element\Template" name="customeline" template="Magento_Theme::customeline.phtml"/>
   <referenceBlock name="logo">
            <argument name="logo_file" xsi:type="string">images/mytheme-logo-snake.png</argument>
            <argument name="logo_img_width" xsi:type="number">80</argument>
            <argument name="logo_img_height" xsi:type="number">80</argument>
    <referenceBlock name="report.bugs" remove="true"/>
    <referenceBlock name="catalog.compare.sidebar" remove="true"/>
    <referenceBlock name="wishlist_sidebar" remove="true"/>
    <referenceBlock name="copyright" remove="true"/>

here my phtml file

<div class="block" style="float: left;">
<?php echo __('this is custom theme'); ?>




exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'Magento_Theme::customeline.phtml' in module: '' block's name: 'customline'


Kindly check the code of default.xml. You specify template file name "customeline.phtml" and you create file "customline.phtml". Change file name in your code like this.

<referenceContainer name="header-wrapper">
       <block class="Magento\Framework\View\Element\Template" name="customeline" template="Magento_Theme::customline.phtml"/>
|improve this answer|||||

Put your file in below path :


Change in your default.xml


<referenceContainer name="header.container">
     <block class="Magento\Framework\View\Element\Template" name="customeline" template="Magento_Theme::html/customeline.phtml"/>            
|improve this answer|||||
  • its not working – Dipak Solanki May 30 '18 at 10:20
  • have you run php bin/magento set:up command after adding file ? – hweb87 May 30 '18 at 10:21
  • i have tried this one – Dipak Solanki May 30 '18 at 10:25
  • I have updated xml code. – hweb87 May 30 '18 at 10:26
  • i created html and moved phtml into folder and change the file name. – Dipak Solanki May 30 '18 at 10:29

Image in PHTML file:

<img src="<?php echo $this->getViewFileUrl('images/demo.png'); ?>"/>

Image in Static Block or CMS page:

<img src="{{view url="images/demo.jpg"}}"/>
|improve this answer|||||
  • @Dipak Solanki is any solution work for you don't forgot to vote up accept answer. – hweb87 May 30 '18 at 11:03

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.