shimuldas72/hello-world

该软件包最新版本(dev-master)没有提供许可证信息。

Yii2 表单模块

安装: 13

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:yii2-extension

dev-master 2017-04-08 13:19 UTC

This package is not auto-updated.

Last update: 2024-09-29 04:06:29 UTC


README

功能

  • 上传图片
  • 拖动图片并更改位置
  • 制作相册模板
  • 使用内联小部件

gallery

安装

Composer

通过 Composer 安装此扩展是首选方式。

运行 php composer.phar require sadovojav/yii2-gallery-module "dev-master"

或者将 "sadovojav/yii2-gallery-module": "dev-master" 添加到你的 composer.json 文件的 require 部分

迁移

yii migrate --migrationPath=@vendor/sadovojav/yii2-gallery-module/migrations

配置

  1. 在你的配置文件中附加模块
'modules' => [
    'gallery' => [
        'class' => 'sadovojav\gallery\Module',
    ],
],
  • string basePath = @webroot/galleries - 基础路径
  • integer queryCacheDuration = 86400 - 查询缓存时长
  • bool uniqueName = false - 生成唯一名称
  1. 如果你想使用自定义模板,可以设置路径映射
'view' => [
	'theme' => [
		'pathMap' => [
			'@sadovojav/gallery/widgets/views' => '@app/web/views/gallery'
		],
		'baseUrl'   => '@web/web'
	],
],

管理

相册管理器 - /gallery/gallery/index

使用方法

1. 小部件

<?= \sadovojav\gallery\widgets\Gallery::widget([
    'galleryId' => $model->galleryId
]); ?>
  • integer galleryId required - 相册 ID
  • bool caption = false - 在默认模板中显示标题
  • string template = null - 你的自定义小部件模板

2. 内联小部件

见这里 -> https://github.com/sadovojav/yii2-inline-widgets-behavior