【问题标题】:Why isn't my new Magento theme showing when I activate it?为什么我的新 Magento 主题在我激活时没有显示?
【发布时间】:2016-03-04 10:10:56
【问题描述】:

我已经创建了这些目录:

-应用程序 -设计 -前端 -小贩 -主题 -theme.xml -媒体 -预览.jpg

主题已加载到后端设计列表中,但是当我激活它时,前端什么也没有显示。

怎么了?

【问题讨论】:

    标签: php magento2


    【解决方案1】:

    我从Magento.StackExchange找到了解决方案:

    app/design/frontend/Magento/mytheme/theme.xml

    <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
         <title>My theme</title> <!-- your theme's name -->
         <parent>Magento/blank</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->
         <media>
             <preview_image>media/preview.jpg</preview_image> <!-- the path to your theme's preview image -->
         </media>
     </theme>
    

    app/design/frontend/Magento/mytheme/composer.json

    {
        "name": "magento/theme-frontend-blank",
        "description": "N/A",
        "require": {
            "php": "~5.5.0|~5.6.0|~7.0.0",
            "magento/theme-frontend-blank": "100.0.*",
            "magento/framework": "100.0.*"
        },
        "type": "magento2-theme",
        "version": "100.0.1",
        "license": [
            "OSL-3.0",
            "AFL-3.0"
        ],
        "autoload": {
            "files": [
                "registration.php"
            ]
        }
    }
    

    app/design/frontend/Magento/mytheme/registration.php

    <?php
    /**
    * Copyright © 2015 Magento. All rights reserved.
    * See COPYING.txt for license details.
    */
    \Magento\Framework\Component\ComponentRegistrar::register(
        \Magento\Framework\Component\ComponentRegistrar::THEME,
        'frontend/Magento/mytheme',
        __DIR__
    );
    

    【讨论】:

    • 我已经完成了这一切,但是当我从配置中调试时,应用程序/设计中没有显示任何文件,所有文件都来自供应商/设计/或在某些情况下应用程序/代码/设计/
    • bin/php bin/magento setup:static-content:deploy 你部署内容了吗?
    • 我在 magentoce2 文件夹中的开发人员模式下更改了我的项目,之后我在其他文件夹中显示了 vendor/design/
    • 转到目录并仅部署该项目内容
    • 我做了很多次。我在 7 个文件夹中工作,现在转到第 8 个文件夹。我又遇到了一个问题。
    猜你喜欢
    • 2016-07-27
    • 1970-01-01
    • 1970-01-01
    • 2011-06-24
    • 1970-01-01
    • 2012-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多