Actually I created A Custom Customer Account Navigation link by using This xml

<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="customer_account_navigation">
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="custom-link" after="-">
                    <argument name="label" xsi:type="string">My Custom Link</argument>
                    <argument name="path" xsi:type="string">frontname/controller/action</argument>                    

It Created The "My Custom Link" at the navigation links list but when I click on that link the corresponding phtml is opening in new page which is not containing customer navigation links at all on left side.How can I display that phtml beside the navigation links same like other link phtml.


You need to create frontname_controllername_action.xml file in view/frontend/layout of your module add below code to it

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="customer_account"/>
        <referenceBlock name="page.main.title">
        <action method="setPageTitle">
            <argument translate="true" name="title" xsi:type="string">Your Title</argument>
        <referenceContainer name="content">
            <block class="Vendor\Modulename\Block\Blockname" name="custompage" template="Vendor_Modulename::custompage.phtml" />

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.