0

here my default.xml

 <body>       
    <referenceContainer name="header-wrapper">
       <block class="Magento\Framework\View\Element\Template" name="customeline" template="Magento_Theme::customeline.phtml"/>
   </referenceContainer>
   <referenceBlock name="logo">
        <arguments>
            <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>
        </arguments>
    </referenceBlock>
    <referenceBlock name="report.bugs" remove="true"/>
    <referenceBlock name="catalog.compare.sidebar" remove="true"/>
    <referenceBlock name="wishlist_sidebar" remove="true"/>
    <referenceBlock name="copyright" remove="true"/>
</body>

here my phtml file

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

/frontend/Bigstore/Theme/Magento_Theme/layout/default.xml

/frontend/BIgstore/Theme/Magento_Theme/templates/customline.phtml

error:-

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

3 Answers 3

1

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

Put your file in below path :

/frontend/BIgstore/Theme/Magento_Theme/templates/html/customline.phtml

Change in your default.xml

/frontend/Bigstore/Theme/Magento_Theme/layout/default.xml

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

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"}}"/>
1
  • @Dipak Solanki is any solution work for you don't forgot to vote up accept answer. Commented 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.