Skip to main content
this answer works but the tab wont be set as current when visited if index is in the path
Source Link
  1. Create customer_account.xml into Mytest/Myemail/view/frontend/layout

     <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
         <body>
             <referenceBlock name="customer_account_navigation">
                 <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-myemail">
                     <arguments>
                         <argument name="path" xsi:type="string">myemail/customer/index<customer</argument>
                         <argument name="label" xsi:type="string"> MyEmail</argument>
                     </arguments>
                 </block>
             </referenceBlock>
         </body>
      </page>
    
  2. Create myemail_customer_index.xml into Mytest/Myemail/view/frontend/layout

     <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
         <update handle="customer_account"/>
         <body>
             <referenceBlock name="page.main.title">
                 <action method="setPageTitle">
                     <argument translate="true" name="title" xsi:type="string">MyEmail</argument>
                 </action>
              </referenceBlock>
              <referenceContainer name="content">
                  <block class="Magento\Framework\View\Element\Template" name="my_email" template="Mytest_Myemail::test.phtml">
                  </block>
             </referenceContainer>
         </body>
     </page>
    
  3. Create Index.php into Mytest/Myemail/Controller/Customer

     <?php
     namespace Mytest\Myemail\Controller\Customer;
    
     class Index extends \Magento\Framework\App\Action\Action {
    
      public function execute() {
    
         $this->_view->loadLayout();
    
         $this->_view->renderLayout();
       }
    
     }
    
  4. Create test.phtml into Mytest/Myemail/view/frontend/templates

     <?php // Add some code ?>
    
  5. Put routes.xml into folder Mytest/Myemail/etc/frontend with the following inside:

     <?xml version="1.0"?> 
     <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc‌​/routes.xsd">
         <router id="standard"> 
             <route id="myemail" frontName="myemail"> 
                 <module name="Mytest_Myemail" /> 
             </route> 
         </router> 
     </config>
    
  1. Create customer_account.xml into Mytest/Myemail/view/frontend/layout

     <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
         <body>
             <referenceBlock name="customer_account_navigation">
                 <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-myemail">
                     <arguments>
                         <argument name="path" xsi:type="string">myemail/customer/index</argument>
                         <argument name="label" xsi:type="string"> MyEmail</argument>
                     </arguments>
                 </block>
             </referenceBlock>
         </body>
      </page>
    
  2. Create myemail_customer_index.xml into Mytest/Myemail/view/frontend/layout

     <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
         <update handle="customer_account"/>
         <body>
             <referenceBlock name="page.main.title">
                 <action method="setPageTitle">
                     <argument translate="true" name="title" xsi:type="string">MyEmail</argument>
                 </action>
              </referenceBlock>
              <referenceContainer name="content">
                  <block class="Magento\Framework\View\Element\Template" name="my_email" template="Mytest_Myemail::test.phtml">
                  </block>
             </referenceContainer>
         </body>
     </page>
    
  3. Create Index.php into Mytest/Myemail/Controller/Customer

     <?php
     namespace Mytest\Myemail\Controller\Customer;
    
     class Index extends \Magento\Framework\App\Action\Action {
    
      public function execute() {
    
         $this->_view->loadLayout();
    
         $this->_view->renderLayout();
       }
    
     }
    
  4. Create test.phtml into Mytest/Myemail/view/frontend/templates

     <?php // Add some code ?>
    
  5. Put routes.xml into folder Mytest/Myemail/etc/frontend with the following inside:

     <?xml version="1.0"?> 
     <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc‌​/routes.xsd">
         <router id="standard"> 
             <route id="myemail" frontName="myemail"> 
                 <module name="Mytest_Myemail" /> 
             </route> 
         </router> 
     </config>
    
  1. Create customer_account.xml into Mytest/Myemail/view/frontend/layout

     <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
         <body>
             <referenceBlock name="customer_account_navigation">
                 <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-myemail">
                     <arguments>
                         <argument name="path" xsi:type="string">myemail/customer</argument>
                         <argument name="label" xsi:type="string"> MyEmail</argument>
                     </arguments>
                 </block>
             </referenceBlock>
         </body>
      </page>
    
  2. Create myemail_customer_index.xml into Mytest/Myemail/view/frontend/layout

     <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
         <update handle="customer_account"/>
         <body>
             <referenceBlock name="page.main.title">
                 <action method="setPageTitle">
                     <argument translate="true" name="title" xsi:type="string">MyEmail</argument>
                 </action>
              </referenceBlock>
              <referenceContainer name="content">
                  <block class="Magento\Framework\View\Element\Template" name="my_email" template="Mytest_Myemail::test.phtml">
                  </block>
             </referenceContainer>
         </body>
     </page>
    
  3. Create Index.php into Mytest/Myemail/Controller/Customer

     <?php
     namespace Mytest\Myemail\Controller\Customer;
    
     class Index extends \Magento\Framework\App\Action\Action {
    
      public function execute() {
    
         $this->_view->loadLayout();
    
         $this->_view->renderLayout();
       }
    
     }
    
  4. Create test.phtml into Mytest/Myemail/view/frontend/templates

     <?php // Add some code ?>
    
  5. Put routes.xml into folder Mytest/Myemail/etc/frontend with the following inside:

     <?xml version="1.0"?> 
     <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc‌​/routes.xsd">
         <router id="standard"> 
             <route id="myemail" frontName="myemail"> 
                 <module name="Mytest_Myemail" /> 
             </route> 
         </router> 
     </config>
    

Ex:-Namespace:- Mytest Modulename : Myemail;
1 Create customer_account.xml into Mytest/Myemail/view/frontend/layout

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="customer_account_navigation">
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-myemail">
                <arguments>
                    <argument name="path" xsi:type="string">myemail/customer/index</argument>
                    <argument name="label" xsi:type="string"> MyEmail</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>

2.Create myemail_customer_index.xml into Mytest/Myemail/view/frontend/layout

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<body>
    <referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">MyEmail</argument>
            </action>
     </referenceBlock>
     <referenceContainer name="content">
        <block class="Magento\Framework\View\Element\Template" name="my_email" template="Mytest_Myemail::test.phtml">
        </block>
    </referenceContainer>
</body>
</page>

3 Create Index.php into Mytest/Myemail/Controller/Customer

<?php
namespace Mytest\Myemail\Controller\Customer;

class Index extends \Magento\Framework\App\Action\Action {

 public function execute() {

    $this->_view->loadLayout();

    $this->_view->renderLayout();
  }

}

4.Create test.phtml into Mytest/Myemail/view/frontend/templates

<?php // Add some code ?>
  1. Create customer_account.xml into Mytest/Myemail/view/frontend/layout

     <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
         <body>
             <referenceBlock name="customer_account_navigation">
                 <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-myemail">
                     <arguments>
                         <argument name="path" xsi:type="string">myemail/customer/index</argument>
                         <argument name="label" xsi:type="string"> MyEmail</argument>
                     </arguments>
                 </block>
             </referenceBlock>
         </body>
      </page>
    
  2. Create myemail_customer_index.xml into Mytest/Myemail/view/frontend/layout

     <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
         <update handle="customer_account"/>
         <body>
             <referenceBlock name="page.main.title">
                 <action method="setPageTitle">
                     <argument translate="true" name="title" xsi:type="string">MyEmail</argument>
                 </action>
              </referenceBlock>
              <referenceContainer name="content">
                  <block class="Magento\Framework\View\Element\Template" name="my_email" template="Mytest_Myemail::test.phtml">
                  </block>
             </referenceContainer>
         </body>
     </page>
    
  3. Create Index.php into Mytest/Myemail/Controller/Customer

     <?php
     namespace Mytest\Myemail\Controller\Customer;
    
     class Index extends \Magento\Framework\App\Action\Action {
    
      public function execute() {
    
         $this->_view->loadLayout();
    
         $this->_view->renderLayout();
       }
    
     }
    
  4. Create test.phtml into Mytest/Myemail/view/frontend/templates

     <?php // Add some code ?>
    
  5. Put routes.xml into folder Mytest/Myemail/etc/frontend with the following inside:

     <?xml version="1.0"?> 
     <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc‌​/routes.xsd">
         <router id="standard"> 
             <route id="myemail" frontName="myemail"> 
                 <module name="Mytest_Myemail" /> 
             </route> 
         </router> 
     </config>
    

Ex:-Namespace:- Mytest Modulename : Myemail;
1 Create customer_account.xml into Mytest/Myemail/view/frontend/layout

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="customer_account_navigation">
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-myemail">
                <arguments>
                    <argument name="path" xsi:type="string">myemail/customer/index</argument>
                    <argument name="label" xsi:type="string"> MyEmail</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>

2.Create myemail_customer_index.xml into Mytest/Myemail/view/frontend/layout

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<body>
    <referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">MyEmail</argument>
            </action>
     </referenceBlock>
     <referenceContainer name="content">
        <block class="Magento\Framework\View\Element\Template" name="my_email" template="Mytest_Myemail::test.phtml">
        </block>
    </referenceContainer>
</body>
</page>

3 Create Index.php into Mytest/Myemail/Controller/Customer

<?php
namespace Mytest\Myemail\Controller\Customer;

class Index extends \Magento\Framework\App\Action\Action {

 public function execute() {

    $this->_view->loadLayout();

    $this->_view->renderLayout();
  }

}

4.Create test.phtml into Mytest/Myemail/view/frontend/templates

<?php // Add some code ?>

Ex:-Namespace:- Mytest Modulename : Myemail;

  1. Create customer_account.xml into Mytest/Myemail/view/frontend/layout

     <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
         <body>
             <referenceBlock name="customer_account_navigation">
                 <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-myemail">
                     <arguments>
                         <argument name="path" xsi:type="string">myemail/customer/index</argument>
                         <argument name="label" xsi:type="string"> MyEmail</argument>
                     </arguments>
                 </block>
             </referenceBlock>
         </body>
      </page>
    
  2. Create myemail_customer_index.xml into Mytest/Myemail/view/frontend/layout

     <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
         <update handle="customer_account"/>
         <body>
             <referenceBlock name="page.main.title">
                 <action method="setPageTitle">
                     <argument translate="true" name="title" xsi:type="string">MyEmail</argument>
                 </action>
              </referenceBlock>
              <referenceContainer name="content">
                  <block class="Magento\Framework\View\Element\Template" name="my_email" template="Mytest_Myemail::test.phtml">
                  </block>
             </referenceContainer>
         </body>
     </page>
    
  3. Create Index.php into Mytest/Myemail/Controller/Customer

     <?php
     namespace Mytest\Myemail\Controller\Customer;
    
     class Index extends \Magento\Framework\App\Action\Action {
    
      public function execute() {
    
         $this->_view->loadLayout();
    
         $this->_view->renderLayout();
       }
    
     }
    
  4. Create test.phtml into Mytest/Myemail/view/frontend/templates

     <?php // Add some code ?>
    
  5. Put routes.xml into folder Mytest/Myemail/etc/frontend with the following inside:

     <?xml version="1.0"?> 
     <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc‌​/routes.xsd">
         <router id="standard"> 
             <route id="myemail" frontName="myemail"> 
                 <module name="Mytest_Myemail" /> 
             </route> 
         </router> 
     </config>
    
deleted 3 characters in body
Source Link
Vishal
  • 773
  • 2
  • 8
  • 18

Add below files into your custom module

Ex:-Namespace:- Mytest Modulename : Myemail;
1 Create customer_account.xml into Mytest/Myemail/view/frontend/layout

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="customer_account_navigation">
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-myemail">
                <arguments>
                    <argument name="path" xsi:type="string">myemail/customer/index</argument>
                    <argument name="label" xsi:type="string"> MyEmail</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>

2.Create myemail_customer_index.xml into Mytest/Myemail/view/frontend/layout

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<body>
    <referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">MyEmail</argument>
            </action>
     </referenceBlock>
     <referenceContainer name="content">
        <block class="Magento\Framework\View\Element\Template" name="my_email" template="Mytest_Myemail::test.phtml">
        </block>
    </referenceContainer>
</body>
</page>

3 Create Index.php into Mytest/Myemail/Controller/Customer

<?php
namespace Magik\Ageverifier\Controller\Customer;Mytest\Myemail\Controller\Customer;

class Index extends \Magento\Framework\App\Action\Action {

 public function execute() {

    $this->_view->loadLayout();

    $this->_view->renderLayout();
  }

}

4.Create test.phtml into Mytest/Myemail/view/frontend/templates

<?php // Add some code ?>

Add below files into your custom module

Ex:-Namespace:- Mytest Modulename : Myemail;
1 Create customer_account.xml into Mytest/Myemail/view/frontend/layout

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="customer_account_navigation">
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-myemail">
                <arguments>
                    <argument name="path" xsi:type="string">myemail/customer/index</argument>
                    <argument name="label" xsi:type="string"> MyEmail</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>

2.Create myemail_customer_index.xml into Mytest/Myemail/view/frontend/layout

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<body>
    <referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">MyEmail</argument>
            </action>
     </referenceBlock>
     <referenceContainer name="content">
        <block class="Magento\Framework\View\Element\Template" name="my_email" template="Mytest_Myemail::test.phtml">
        </block>
    </referenceContainer>
</body>
</page>

3 Create Index.php into Mytest/Myemail/Controller/Customer

<?php
namespace Magik\Ageverifier\Controller\Customer;

class Index extends \Magento\Framework\App\Action\Action {

 public function execute() {

    $this->_view->loadLayout();

    $this->_view->renderLayout();
  }

}

4.Create test.phtml into Mytest/Myemail/view/frontend/templates

<?php // Add some code ?>

Add below files into your custom module

Ex:-Namespace:- Mytest Modulename : Myemail;
1 Create customer_account.xml into Mytest/Myemail/view/frontend/layout

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="customer_account_navigation">
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-myemail">
                <arguments>
                    <argument name="path" xsi:type="string">myemail/customer/index</argument>
                    <argument name="label" xsi:type="string"> MyEmail</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>

2.Create myemail_customer_index.xml into Mytest/Myemail/view/frontend/layout

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<body>
    <referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">MyEmail</argument>
            </action>
     </referenceBlock>
     <referenceContainer name="content">
        <block class="Magento\Framework\View\Element\Template" name="my_email" template="Mytest_Myemail::test.phtml">
        </block>
    </referenceContainer>
</body>
</page>

3 Create Index.php into Mytest/Myemail/Controller/Customer

<?php
namespace Mytest\Myemail\Controller\Customer;

class Index extends \Magento\Framework\App\Action\Action {

 public function execute() {

    $this->_view->loadLayout();

    $this->_view->renderLayout();
  }

}

4.Create test.phtml into Mytest/Myemail/view/frontend/templates

<?php // Add some code ?>
Source Link
Vishal
  • 773
  • 2
  • 8
  • 18
Loading