alexvd / admin-theme-bundle
基于AdminLTE模板的Admin主题,便于集成到symfony中
Requires
- php: >=5.3.0
- alexvd/admin-theme-bundle: ^6.0
- symfony/assetic-bundle: >=2.3
- symfony/event-dispatcher: >=2.3
- symfony/http-foundation: >=2.3
- symfony/http-kernel: >=2.3
- symfony/twig-bundle: >=2.3
Requires (Dev)
- hamcrest/hamcrest-php: dev-master
- mockery/mockery: 0.9.*@dev
This package is not auto-updated.
Last update: 2017-05-04 11:51:48 UTC
README
基于AdminLTE模板的Admin主题,便于集成到symfony。此包集成了多个常用javascript和优秀的AdminLTE模板。
安装
使用composer安装非常简单:此命令将 "alexvd/admin-theme-bundle": "~1.3"
添加到您的composer.json中,并将下载该包
php composer.phar require alexvd/admin-theme-bundle
注意:如果您希望保留AdminLTE主题v1.x,请在composer.json的"require"
部分手动引用 "alexvd/admin-theme-bundle": "~1.1"
并运行 php composer.phar update
在您的kernel中启用此包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new AlexVd\AdminThemeBundle\AlexVdAdminThemeBundle(), ); }
安装资源(最好使用符号链接方法,但硬拷贝也可以)...
php app/console assets:install --symlink
...并获取供应商
php app/console alexvd:admin:fetch-vendor
Symfony 2.8 注意事项
此包需要assetic,但自2.8版本起,symfony不再包含它。要安装assetic,请按照以下步骤操作
php composer.phar require symfony/assetic-bundle
在您的kernel中启用此包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Symfony\Bundle\AsseticBundle\AsseticBundle(), ); }
在 app/config/config_dev.yml
中添加以下行
assetic:
use_controller: false
从模板更改默认值
如果您想更改任何默认值,例如 admin_skin
,您只需在 app/config/config.yml
下的 [twig]
部分定义相同的值。以下是一个示例
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
globals:
admin_skin: skin-blue
您还可以在 app/config/parameters.yml
中定义这些值
admin_skin: skin-blue
然后在 app/config/config.yml
中按以下方式使用
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
globals:
admin_skin: "%admin_skin%"
AdminLTE皮肤包括:skin-blue(此包的默认值)、skin-blue-light、skin-yellow、skin-yellow-light、skin-green、skin-green-light、skin-purple、skin-purple-light、skin-red、skin-red-light、skin-black 和 skin-black-light。如果您想了解更多信息,请查阅AdminLTE的文档此处。
有几个值您可以在不修改包的情况下更改,只需查看 Resources/views
下的内容即可。就是这样。
升级注意事项
版本 >= 1.3 包含位于 Resources/public/static/[prod|dev]
下的预包装资产文件。因此,不再严格要求使用bower和/或assetic。但是,assetic组仍然存在,应该像往常一样工作。