3

I keep getting this error in system log:

Invalid template file: 'Inchoo_SocialConnect::inchoo/socialconnect/google/‌​button.phtml' in module: 'Inchoo_SocialConnect' block's name: 'inchoo_socialconnect_login_google_button' [] []

i also get these two main.INFO:

Cache file with merged layout: LAYOUT_frontend_STORE1_2999a55d7d9f00b9a016b5e16762ce70a and handles default, customer_account_login: Please correct the XML data and try again.

main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_20a98983867a1770682b48d9a0ad63441 and handles 1column: Please correct the XML data and try again.

snippet my layout file:

    <block class="Inchoo\SocialConnect\Block\Login" name="inchoo_socialconnect_login" template="Inchoo_SocialConnect::inchoo/socialconnect/login.phtml">
                <block class="Inchoo\SocialConnect\Block\Google\Button" name="inchoo_socialconnect_login_google_button" template="Inchoo_SocialConnect::inchoo/socialconnect/google/‌​button.phtml"/>
    </block>

button.phtml file:

<div class="clearer">
    <div class="inchoo-socialconnect-facebook">
        <div class="inchoo-socialconnect-facebook-inner">
            <a href="<?php echo $this->escapeUrl($this->_getButtonUrl()); ?>"><?php echo $this->_getButtonText(); ?></a>
        </div>
        <div class="inchoo-socialconnect-facebook-right"></div>
    </div>
</div>

button.phtml gets called from login.phtml:

<div class="buttons-set">
      <?php echo $this->getChildHtml('inchoo_socialconnect_login_google_button'); ?>
      <p>Test</p>
</div>
5
  • what is the exact path of your template file? Nov 16 '16 at 11:02
  • @RonakChauhan fullpath: 'C:\xampp\htdocs\Magento2\project-community-edition\app\code\Inchoo\SocialConnect\view\frontend\templates\inchoo\socialconnect\google\button.phtml'
    – Callum
    Nov 16 '16 at 11:15
  • set Template like this : Inchoo_SocialConnect::socialconnect/login.phtml Nov 16 '16 at 11:17
  • and would "inchoo_socialconnect_login_google_button" be "Inchoo_SocialConnect::socialconnect/google/button‌​.phtml"?
    – Callum
    Nov 16 '16 at 11:22
  • yes, just need to remove module name as i gave in path Nov 16 '16 at 11:25
1

set template like this:

Inchoo_SocialConnect::socialconnect/login.phtml Inchoo_SocialConnect::socialconnect/google/‌​button.phtml

7
  • just tried it, same error unfortunately
    – Callum
    Nov 16 '16 at 11:33
  • are you able to call block for login? Nov 16 '16 at 11:37
  • no: "Invalid template file: 'Inchoo_SocialConnect::socialconnect/login.phtml' in module: 'Inchoo_SocialConnect' block's name: 'inchoo_socialconnect_login' [] []"
    – Callum
    Nov 16 '16 at 11:39
  • first remove button block from xml and try only single block of that login Nov 16 '16 at 11:40
  • I'll give it a go
    – Callum
    Nov 16 '16 at 12:05
0

For some reason. Magento 2 doesn't like button.phtml being in a custom folder (Inchoo_SocialConnect::google/‌​button.phtml), so i moved it to the root of the templates folder along side login.phtml (Inchoo_SocialConnect::login.phtml) so the template file path for button.phtml is now:

Inchoo_SocialConnect::button.phtml

I called it like this:

<?php echo $block->getBlockHtml('inchoo_socialconnect_login_button'); ?>

and my layout file is as follows:

<body>
        <referenceContainer name="customer.login.container">
        <block class="Inchoo\SocialConnect\Block\Login" name="inchoo_socialconnect_login" template="Inchoo_SocialConnect::login.phtml" cacheable="false"/>          
        <block class="Inchoo\SocialConnect\Block\Pixelpin\Button" name="inchoo_socialconnect_login_button" template="Inchoo_SocialConnect::button.phtml" cacheable="false"/>     
        </referenceContainer>
    </body>

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.