Invalid template file on custom module












1















Issue



Exception #0 (MagentoFrameworkExceptionValidatorException): Invalid template file: 'TT::calculator.phtml' in module: 'Magento_Catalog' block's name: 'calculator.tab'



Layout Location:



app/code/TT/Calculator/view/frontend/layout/catalog_product_view.xml



<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.details">
<block class="MagentoCatalogBlockProductView" name="calculator.tab" template="TT::calculator.phtml" group="detailed_info">
<arguments>
<argument translate="true" name="title" xsi:type="string">Calculator</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>


Template Location:



app/code/TT/Calculator/view/frontend/templates/calculator.phtml



Questions




  1. I've seen some solutions where the *.phtml file is saved in app/design but I'm trying to get this to work in app/code. What have I missed?

  2. Also, does this "extend" catalog_product_view.xml or replace it?










share|improve this question

























  • You have to change to TT_Calculator::calculator.phtml.

    – Nero Phung
    Nov 27 '17 at 15:56











  • I typo'd after fixing, making me think it didn't work. Thanks all!

    – Craig
    Nov 27 '17 at 16:37
















1















Issue



Exception #0 (MagentoFrameworkExceptionValidatorException): Invalid template file: 'TT::calculator.phtml' in module: 'Magento_Catalog' block's name: 'calculator.tab'



Layout Location:



app/code/TT/Calculator/view/frontend/layout/catalog_product_view.xml



<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.details">
<block class="MagentoCatalogBlockProductView" name="calculator.tab" template="TT::calculator.phtml" group="detailed_info">
<arguments>
<argument translate="true" name="title" xsi:type="string">Calculator</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>


Template Location:



app/code/TT/Calculator/view/frontend/templates/calculator.phtml



Questions




  1. I've seen some solutions where the *.phtml file is saved in app/design but I'm trying to get this to work in app/code. What have I missed?

  2. Also, does this "extend" catalog_product_view.xml or replace it?










share|improve this question

























  • You have to change to TT_Calculator::calculator.phtml.

    – Nero Phung
    Nov 27 '17 at 15:56











  • I typo'd after fixing, making me think it didn't work. Thanks all!

    – Craig
    Nov 27 '17 at 16:37














1












1








1








Issue



Exception #0 (MagentoFrameworkExceptionValidatorException): Invalid template file: 'TT::calculator.phtml' in module: 'Magento_Catalog' block's name: 'calculator.tab'



Layout Location:



app/code/TT/Calculator/view/frontend/layout/catalog_product_view.xml



<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.details">
<block class="MagentoCatalogBlockProductView" name="calculator.tab" template="TT::calculator.phtml" group="detailed_info">
<arguments>
<argument translate="true" name="title" xsi:type="string">Calculator</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>


Template Location:



app/code/TT/Calculator/view/frontend/templates/calculator.phtml



Questions




  1. I've seen some solutions where the *.phtml file is saved in app/design but I'm trying to get this to work in app/code. What have I missed?

  2. Also, does this "extend" catalog_product_view.xml or replace it?










share|improve this question
















Issue



Exception #0 (MagentoFrameworkExceptionValidatorException): Invalid template file: 'TT::calculator.phtml' in module: 'Magento_Catalog' block's name: 'calculator.tab'



Layout Location:



app/code/TT/Calculator/view/frontend/layout/catalog_product_view.xml



<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.details">
<block class="MagentoCatalogBlockProductView" name="calculator.tab" template="TT::calculator.phtml" group="detailed_info">
<arguments>
<argument translate="true" name="title" xsi:type="string">Calculator</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>


Template Location:



app/code/TT/Calculator/view/frontend/templates/calculator.phtml



Questions




  1. I've seen some solutions where the *.phtml file is saved in app/design but I'm trying to get this to work in app/code. What have I missed?

  2. Also, does this "extend" catalog_product_view.xml or replace it?







magento2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 27 '17 at 16:33







Craig

















asked Nov 27 '17 at 15:55









CraigCraig

7371519




7371519













  • You have to change to TT_Calculator::calculator.phtml.

    – Nero Phung
    Nov 27 '17 at 15:56











  • I typo'd after fixing, making me think it didn't work. Thanks all!

    – Craig
    Nov 27 '17 at 16:37



















  • You have to change to TT_Calculator::calculator.phtml.

    – Nero Phung
    Nov 27 '17 at 15:56











  • I typo'd after fixing, making me think it didn't work. Thanks all!

    – Craig
    Nov 27 '17 at 16:37

















You have to change to TT_Calculator::calculator.phtml.

– Nero Phung
Nov 27 '17 at 15:56





You have to change to TT_Calculator::calculator.phtml.

– Nero Phung
Nov 27 '17 at 15:56













I typo'd after fixing, making me think it didn't work. Thanks all!

– Craig
Nov 27 '17 at 16:37





I typo'd after fixing, making me think it didn't work. Thanks all!

– Craig
Nov 27 '17 at 16:37










3 Answers
3






active

oldest

votes


















4














1.You have to change the code to TT_Calculator::calculator.phtml:



<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.details">
<block class="MagentoCatalogBlockProductView" name="calculator.tab" template="TT_Calculator::calculator.phtml" group="detailed_info">
<arguments>
<argument translate="true" name="title" xsi:type="string">Calculator</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>


2.Magento will check all the layout (XML file) in all the modules and merge them, not extend.






share|improve this answer































    4














    Your template file location should be TT_Calculator::calculator.phtml



    <block class="MagentoCatalogBlockProductView" name="calculator.tab" template="TT_Calculator::calculator.phtml" group="detailed_info">
    <arguments>
    <argument translate="true" name="title" xsi:type="string">Calculator</argument>
    </arguments>
    </block>





    share|improve this answer































      0














      I have resolved this issue now. The problem was the allow symlink of the system config:



      php bin/magento config:set dev/template/allow_symlink 1 --lock-env





      share|improve this answer








      New contributor




      Hào Nghiêm Xuân is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "479"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f203379%2finvalid-template-file-on-custom-module%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        4














        1.You have to change the code to TT_Calculator::calculator.phtml:



        <?xml version="1.0"?>

        <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <body>
        <referenceBlock name="product.info.details">
        <block class="MagentoCatalogBlockProductView" name="calculator.tab" template="TT_Calculator::calculator.phtml" group="detailed_info">
        <arguments>
        <argument translate="true" name="title" xsi:type="string">Calculator</argument>
        </arguments>
        </block>
        </referenceBlock>
        </body>
        </page>


        2.Magento will check all the layout (XML file) in all the modules and merge them, not extend.






        share|improve this answer




























          4














          1.You have to change the code to TT_Calculator::calculator.phtml:



          <?xml version="1.0"?>

          <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
          <body>
          <referenceBlock name="product.info.details">
          <block class="MagentoCatalogBlockProductView" name="calculator.tab" template="TT_Calculator::calculator.phtml" group="detailed_info">
          <arguments>
          <argument translate="true" name="title" xsi:type="string">Calculator</argument>
          </arguments>
          </block>
          </referenceBlock>
          </body>
          </page>


          2.Magento will check all the layout (XML file) in all the modules and merge them, not extend.






          share|improve this answer


























            4












            4








            4







            1.You have to change the code to TT_Calculator::calculator.phtml:



            <?xml version="1.0"?>

            <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
            <body>
            <referenceBlock name="product.info.details">
            <block class="MagentoCatalogBlockProductView" name="calculator.tab" template="TT_Calculator::calculator.phtml" group="detailed_info">
            <arguments>
            <argument translate="true" name="title" xsi:type="string">Calculator</argument>
            </arguments>
            </block>
            </referenceBlock>
            </body>
            </page>


            2.Magento will check all the layout (XML file) in all the modules and merge them, not extend.






            share|improve this answer













            1.You have to change the code to TT_Calculator::calculator.phtml:



            <?xml version="1.0"?>

            <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
            <body>
            <referenceBlock name="product.info.details">
            <block class="MagentoCatalogBlockProductView" name="calculator.tab" template="TT_Calculator::calculator.phtml" group="detailed_info">
            <arguments>
            <argument translate="true" name="title" xsi:type="string">Calculator</argument>
            </arguments>
            </block>
            </referenceBlock>
            </body>
            </page>


            2.Magento will check all the layout (XML file) in all the modules and merge them, not extend.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 27 '17 at 15:59









            Nero PhungNero Phung

            8341420




            8341420

























                4














                Your template file location should be TT_Calculator::calculator.phtml



                <block class="MagentoCatalogBlockProductView" name="calculator.tab" template="TT_Calculator::calculator.phtml" group="detailed_info">
                <arguments>
                <argument translate="true" name="title" xsi:type="string">Calculator</argument>
                </arguments>
                </block>





                share|improve this answer




























                  4














                  Your template file location should be TT_Calculator::calculator.phtml



                  <block class="MagentoCatalogBlockProductView" name="calculator.tab" template="TT_Calculator::calculator.phtml" group="detailed_info">
                  <arguments>
                  <argument translate="true" name="title" xsi:type="string">Calculator</argument>
                  </arguments>
                  </block>





                  share|improve this answer


























                    4












                    4








                    4







                    Your template file location should be TT_Calculator::calculator.phtml



                    <block class="MagentoCatalogBlockProductView" name="calculator.tab" template="TT_Calculator::calculator.phtml" group="detailed_info">
                    <arguments>
                    <argument translate="true" name="title" xsi:type="string">Calculator</argument>
                    </arguments>
                    </block>





                    share|improve this answer













                    Your template file location should be TT_Calculator::calculator.phtml



                    <block class="MagentoCatalogBlockProductView" name="calculator.tab" template="TT_Calculator::calculator.phtml" group="detailed_info">
                    <arguments>
                    <argument translate="true" name="title" xsi:type="string">Calculator</argument>
                    </arguments>
                    </block>






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 27 '17 at 15:57









                    harriharri

                    2,8841550




                    2,8841550























                        0














                        I have resolved this issue now. The problem was the allow symlink of the system config:



                        php bin/magento config:set dev/template/allow_symlink 1 --lock-env





                        share|improve this answer








                        New contributor




                        Hào Nghiêm Xuân is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.

























                          0














                          I have resolved this issue now. The problem was the allow symlink of the system config:



                          php bin/magento config:set dev/template/allow_symlink 1 --lock-env





                          share|improve this answer








                          New contributor




                          Hào Nghiêm Xuân is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.























                            0












                            0








                            0







                            I have resolved this issue now. The problem was the allow symlink of the system config:



                            php bin/magento config:set dev/template/allow_symlink 1 --lock-env





                            share|improve this answer








                            New contributor




                            Hào Nghiêm Xuân is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.










                            I have resolved this issue now. The problem was the allow symlink of the system config:



                            php bin/magento config:set dev/template/allow_symlink 1 --lock-env






                            share|improve this answer








                            New contributor




                            Hào Nghiêm Xuân is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.









                            share|improve this answer



                            share|improve this answer






                            New contributor




                            Hào Nghiêm Xuân is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.









                            answered 21 mins ago









                            Hào Nghiêm XuânHào Nghiêm Xuân

                            1




                            1




                            New contributor




                            Hào Nghiêm Xuân is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.





                            New contributor





                            Hào Nghiêm Xuân is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.






                            Hào Nghiêm Xuân is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Magento Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f203379%2finvalid-template-file-on-custom-module%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Magento 2 controller redirect on button click in phtml file

                                Polycentropodidae