gpt4 book ai didi

Yii2主题集成

转载 作者:行者123 更新时间:2023-12-04 01:27:48 27 4
gpt4 key购买 nike

我已经安装了 Yii2 高级应用程序,现在我想更改后端主题。
我该怎么做?
是否有任何文件需要告诉 Yii2 使用我的自定义主题?
我在 backend/web/themes/mytheme 下建立了我的主题.
我刚刚在 advanced/backend/config/main.php 中替换了此代码,但什么也没发生!

 'view' => [
'theme' => [
'pathMap' => ['@app/views' => '@app/themes/mytheme'],
'baseUrl' => '@web/themes/mytheme',
],
],

然后我在 common/config/main.php下替换了这个代码但什么都没有改变!

最佳答案

在 Yii2 中更改主题的另一种方法是:

  • 在要更改主题的前端或后端的 web 文件夹中创建一个主题目录。
  • 将您的主题文件夹放在主题目录中。
  • 更改前端或后端 Assets 文件夹中 AppAsset.php 中的 $css 和 $js 变量,例如:
    public $css = [
    //'css/site.css',
    'themes/theme_folder/css/font-awesome.min.css',
    'themes/theme_folder/css/slicknav.css',
    'themes/theme_folder/css/style.css',
    'themes/theme_folder/css/responsive.css',
    'themes/theme_folder/css/animate.css',
    'themes/theme_folder/css/colors/red.css',
    //'themes/margo/asset/css/bootstrap.min.css',
    ];
    public $js = [
    'themes/theme_folder/js/jquery.migrate.js',
    'themes/theme_folder/js/modernizrr.js',
    'themes/theme_folder/js/jquery.fitvids.js',
    'themes/theme_folder/js/owl.carousel.min.js',
    'themes/theme_folder/js/nivo-lightbox.min.js',
    //'themes/theme_folder/js/jquery-2.1.4.min.js',
    //'themes/theme_folder/asset/js/bootstrap.min.js'
    ];
  • 不要包含核心 bootstrap css、bootstrap js 和 jquery js,因为这些是 Yii2 提供的核心 API。我已经在上面评论了它们。
  • 使用以下代码在 main.php 布局文件或其他站点页面中引用主题资源(css、js、图像等):
        <?= Yii::getAlias('@web/themes/theme_folder') ?>/images/margo.png
  • 无需在 layouts->main.php 文件中包含 css 或 js 文件:)
  • 关于Yii2主题集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25622565/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com