-1

嗨,我是新来的Magento 2,我想知道我必须将 vendor/magento/module-theme/view/frontend/layout/default.xml文件放在哪里,我试图复制文件并将其放在c:\wamp\www\kk2\app\design\frontend\Magento\MyStore\layout 文件夹中并且无法正常工作。我也尝试了c:\wamp\www\kk2\app\design\frontend\Magento\MyStore\module-theme\layout其他选项,但我不知道我必须把它放在哪里才能开始修改主题,Magento 官方页面上的文档不是很清楚。

4

2 回答 2

1

您不需要复制任何文件。您可以创建自己的主题。引用创建主题的步骤

  1. 为主题下创建一个目录app/design/frontend/<your_vendor_name>/<your_theme_name>
  2. 添加一个声明文件theme.xml,并可选择创建etc目录并创建一个名为view.xml主题目录的文件。
  3. 添加一个composer.json文件。
  4. 添加registration.php.
  5. 为 CSS、JavaScript、图像和字体创建目录。在管理面板中配置您的主题。

Luma 主题不是为了继承而设计的。请在 Github 上查看此评论。但是,您可以从空白主题继承如下:

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
 <title>New 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>

于 2015-12-16T21:02:33.990 回答
0

Create folder and copy default.xml file in your theme

app/design/frontend/magento/<your_theme_name>/magento_theme/layout/default.xml

remove generate folder and run

sudo php -f bin/magento setup:static-content:deploy

It's working

于 2015-12-23T11:13:06.620 回答