I add a new link to my account navigation and i want to open in the right side my content. Unfortunately, when i press on it it goes to a new window that say the page doesn’t exist
In app/code/PCE/NewPassowrd/web/frontend/layout/customer_account.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="customer_account_navigation">
<block class="MagentoCustomerBlockAccountSortLinkInterface" name="customer-account-navigation-newpassword-change-link">
<arguments>
<argument name="path" xsi:type="string">newpassword/change</argument>
<argument name="label" xsi:type="string">New Password</argument>
<argument name="sortOrder" xsi:type="number">250</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
In app/code/PCE/NewPassowrd/web/frontend/layout/routes.xml
<?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 frontName="newpassword" id="newpassword">
<module name="PCE_NewPassword"/>
</route>
</router>
</config>
In app/code/PCE/NewPassowrd/web/frontend/layout/newpassword_change_index.xml
<?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"/>
<head>
<title>
Your First Link
</title>
</head>
<body>
<referenceContainer name="content">
<block class="PCENewPasswordBlockResetPassword" name="newpassword.change.index" template="PCE_NewPassword::change/index.phtml" cacheable="false" />
</referenceContainer>
</body>
</page>
In app/code/PCE/NewPassowrd/Controller/Change/Index.php
<?php
namespace PCENewPasswordControllerChange;
class Index extends MagentoFrameworkAppActionAction
{
/**
* @var MagentoFrameworkViewResultPageFactory
*/
protected $resultPageFactory;
/**
* @param MagentoFrameworkAppActionContext $context
* @param MagentoFrameworkViewResultPageFactory resultPageFactory
*/
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory
)
{
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
}
/**
* Default customer account page
*
* @return void
*/
public function execute()
{
return $this->resultPageFactory->create();
}
}
?>
In app/code/PCE/NewPassowrd/Block/ResetPassword.php
<?php
namespace PCENewPasswordBlock;
class ResetPassword extends MagentoFrameworkViewElementTemplate
{
public function __construct(
MagentoBackendBlockTemplateContext $context,
array $data = ()
)
{
parent::__construct($context, $data);
}
public function getHelloWorld()
{
return 'Hello World';
}
}
?>
In app/code/PCE/NewPassowrd/web/frontend/index.phtml
<h2>
<?php echo $block->getHelloWorld(); ?>
</h2>
<?php
echo 'My First Link Page';
?>
Where i make the mistake. Also i’m new to Magento and i work on 2.3.3