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'

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>
  • 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
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"}}"/>
  • @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.