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'

3 Answers 3


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"/>

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"/>            
  • its not working May 30, 2018 at 10:20
  • have you run php bin/magento set:up command after adding file ? May 30, 2018 at 10:21
  • i have tried this one May 30, 2018 at 10:25
  • I have updated xml code. May 30, 2018 at 10:26
  • i created html and moved phtml into folder and change the file name. May 30, 2018 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"}}"/>
  • @Dipak Solanki is any solution work for you don't forgot to vote up accept answer. May 30, 2018 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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