octopouce-mu / advertising-bundle
广告组件
dev-master
2019-08-23 11:48 UTC
Requires
- php: ^7.1.3
- octopouce-mu/admin-bundle: dev-master
- symfony/framework-bundle: ^4.0
This package is auto-updated.
Last update: 2024-09-23 23:04:48 UTC
README
先决条件
本版本的组件需要 Symfony Flex (>= 4.0) 和 PHP 7。您希望使用 Doctrine ORM 和 MySQL。
安装
- 使用 composer 下载 OctopouceAdvertisingBundle
- 遵循 OctopouceAdminBundle 的安装步骤
- 更新您的数据库模式
- 导入 OctopouceAdminBundle 路由
- 发布资源
- 配置文件安全
- 用法:在页面中添加广告区域
步骤 1:使用 composer 下载 OctopouceAdvertisingBundle
使用 composer 需要该组件
$ composer require octopouce-mu/advertising-bundle
步骤 2:遵循 OctopouceAdminBundle 的安装步骤
为了使该组件正常工作,需要 OctopouceAdminBundle。安装依赖的组件并配置。
步骤 3:更新您的数据库模式
对于 ORM,请运行以下命令。
$ php bin/console doctrine:schema:update --force
注意
如果出现错误 "1071 指定的键太长;最大键长度为 767 字节",请更改 doctrine 的配置
# config/packages/doctrine.yaml doctrine: dbal: charset: utf8 default_table_options: charset: utf8 collate: utf8_unicode_ci
步骤 4:导入 OctopouceAdvertisingBundle 路由文件
现在您已经激活并配置了该组件,如果 Symfony Flex 还未导入该文件,剩下的只是导入 OctopouceAdvertisingBundle 路由文件。
# config/routes/octopouce_advertising.yaml _octopouce_advertising: resource: "@OctopouceAdvertisingBundle/Resources/config/routing/routing.yaml"
步骤 5:发布资源
$ php bin/console assets:install --symlink
步骤 6:配置文件安全
# config/packages/security.yaml security: role_hierarchy: ROLE_ADVERT: ROLE_USER ROLE_ADMIN: [ROLE_ADVERT] ROLE_SUPER_ADMIN: ROLE_ADMIN
步骤 7:用法 - 在页面中添加广告区域
数组 Twig 示例
{{ adzone("Exemple") }}
HTML 示例
{{ adzone("Exemple", true)|raw }}
其他组件
您可以通过 OctopouceAdminBundle 添加组件