Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento2 网站上每个模块的标题都错误_Magento2 - Fatal编程技术网

Magento2 网站上每个模块的标题都错误

Magento2 网站上每个模块的标题都错误,magento2,Magento2,Magento 2为网站上的每个模块显示错误的标题,例如模块保修和付款(创建新客户帐户)。它显示标题路径vendor/magento/module theme/view/frontend/templates/html/title.phtml 如何解决此问题?修复了在自定义模块中设置标题的问题,例如在\Vendor\Module\Controller\Index中 /** * @var \Magento\Framework\View\Result\PageFactory */ protecte

Magento 2为网站上的每个模块显示错误的标题,例如模块保修和付款(创建新客户帐户)。它显示标题路径vendor/magento/module theme/view/frontend/templates/html/title.phtml


如何解决此问题?

修复了在自定义模块中设置标题的问题,例如在\Vendor\Module\Controller\Index中

/**
 * @var \Magento\Framework\View\Result\PageFactory
 */
protected $_resultPageFactory;

/**
 * @param Context $context, 
 * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory,
 */
public function __construct(Context $context, \Magento\Framework\View\Result\PageFactory $resultPageFactory)
{
    $this->_resultPageFactory = $resultPageFactory;
    parent::__construct($context);
}

/**
 * return page factory
 */
public function execute()
{
    $resultPage = $this->_resultPageFactory->create();
    $resultPage->getConfig()->getTitle()->set(__('My Module Title'));
    return $resultPage;
}

检查您是否没有将块添加到从Magento\Sales\block\Order\History块扩展的客户区域的扩展。此块设置构造函数中的页面标题。我已经看到了一个扩展,它可以做到这一点,几个帐户部分的页面标题是“我的订单”