quanzo / yii2-blocks
组织网站上内容块的输出。Yii2模块
1.0.0
2019-09-01 16:47 UTC
Requires
- php: >=7.0
- quanzo/x51-functions: *
- quanzo/yii2-auth: *
- quanzo/yii2-shortcode: *
- yiisoft/yii2: ~2.0.0
- yiisoft/yii2-jui: ~2.0.0
This package is auto-updated.
Last update: 2024-09-29 05:28:46 UTC
README
该模块旨在在网站上显示内容块。块在数据库中创建。按名称分组。并按索引排序。
例如,您可以在网站菜单下组织几个横幅的块。或者组织网站页脚中的链接块。
支持按显示块的限制
-
路由
-
角色 & 规则
您可以向访客显示一个块,向管理员显示另一个块。
-----------------------------------------
模块旨在在网站上显示内容块。块在数据库中创建。按名称分组。并按索引排序。
例如,可以在网站菜单下组织几个横幅的块。或者组织网站页脚中的链接块。
支持对每个块的显示限制
-
按路由
-
按权限
可以显示给访客一个块,显示给管理员另一个块。
-----------------------------------------
安装
使用 composer
composer require "quanzo/yii2-blocks"
或在 composer.json 的 require 部分中添加
"quanzo/yii2-blocks": "*"
安装两个数据库迁移。
配置
$config = [
'modules' => [
'blocks' => [
'class' => 'x51\yii2\modules\blocks\Module'
],
],
];
在rbac中创建角色 blocks_manage
将角色添加到允许编辑的用户
如何使用
echo \x51\yii2\modules\blocks\widgets\Group::widget([
'group' => 'sidebar', // group name
'order' => 'ASC', // direction of sorting blocks in a group
'before' => '', // output content before group
'after' => '', // output content after group
'beforeElement' => '', // display content before each element
'afterElement' => '' // display content after each element
]);