簡體   English   中英

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

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

我是Magento2.2的新手。 我試圖覆蓋Magneto Blank Theme.phtml文件,我已完成以下操作。

空白主題文件路徑 /Magento-Dir/vendor/magento/module-theme/view/frontend/templates/html/title.phtml

我的文件路徑 app / design / frontend / MyTheme / Acorn / module-theme / template / html / title.phtml

我的檔案

<?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; ?>

之后,我運行了php bin/magento setup:static-content:deploy -f刪除了pub / static / frontend文件夾,然后重新加載了我的頁面。 仍然指向空白主題文件。

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

我沒有在這里犯的錯誤,請幫助找出錯誤。

您的文件路徑不正確。 請在以下路徑中覆蓋此文件。

應用程序/設計/前端/ MyTheme的/橡果/ Magento_Theme /模板/ HTML / title.phtml

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM