简体   繁体   English

Magento 2.2:覆盖不反映的.phtml文件

[英]Magento 2.2 : Override the .phtml file not reflecting

I am new to Magento2.2. 我是Magento2.2的新手。 I have tried to override the Magneto Blank Theme.phtml file, I have done the following. 我试图覆盖Magneto Blank Theme.phtml文件,我已完成以下操作。

Blank Theme File Path /Magento-Dir/vendor/magento/module-theme/view/frontend/templates/html/title.phtml 空白主题文件路径 /Magento-Dir/vendor/magento/module-theme/view/frontend/templates/html/title.phtml

My File path app/design/frontend/MyTheme/Acorn/module-theme/template/html/title.phtml 我的文件路径 app / design / frontend / MyTheme / Acorn / module-theme / template / html / title.phtml

My File 我的档案

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/**
 * @var $block \Magento\Theme\Block\Html\Title
 */
$cssClass = $block->getCssClass() ? ' ' . $block->getCssClass() : '';
$title = '';
if (trim($block->getPageHeading())) {
    $title = '<span class="base" data-ui-id="page-title-wrapper" ' .  $block->getAddBaseAttribute() . '>'
        . $block->escapeHtml($block->getPageHeading()) . '</span>';
}
?>
<?php if ($title): ?> <h1>Test Text</h1>
<div class="page-title-wrapper<?= /* @escapeNotVerified */ $cssClass ?>">
    <h1 class="page-title"
        <?php if ($block->getId()): ?> id="<?= /* @escapeNotVerified */ $block->getId() ?>" <?php endif; ?>
        <?php if ($block->getAddBaseAttributeAria()): ?>
            aria-labelledby="<?= /* @escapeNotVerified */ $block->getAddBaseAttributeAria() ?>"
        <?php endif; ?>>
        <?= /* @escapeNotVerified */ $title ?>
    </h1>
    <?= $block->getChildHtml() ?>
</div>
<?php endif; ?>

After this, I had run the php bin/magento setup:static-content:deploy -f removed pub/static/frontend folder then reloaded my page. 之后,我运行了php bin/magento setup:static-content:deploy -f删除了pub / static / frontend文件夹,然后重新加载了我的页面。 Still, it pointing the blank theme file. 仍然指向空白主题文件。

I have followed the http://devdocs.magento.com/guides/v2.2/frontend-dev-guide/templates/template-walkthrough.html 我遵循了http://devdocs.magento.com/guides/v2.2/frontend-dev-guide/templates/template-walkthrough.html

I don't the mistake i have done here, please help to find out the mistake. 我没有在这里犯的错误,请帮助找出错误。

Your file path is incorrect. 您的文件路径不正确。 Please override this file on the below path. 请在以下路径中覆盖此文件。

app/design/frontend/MyTheme/Acorn/Magento_Theme/template/html/title.phtml 应用程序/设计/前端/ MyTheme的/橡果/ Magento_Theme /模板/ HTML / title.phtml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM