承接 black-lamp/yii2-slider 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

black-lamp/yii2-slider

Composer 安装命令:

composer require black-lamp/yii2-slider

包简介

Module for adding image slider to site across dashboard

README 文档

README

Module for adding the image slider to site across dashboard and append it to view with widget help. This extension uses Slick slider.

Build Status Latest Stable Version Latest Unstable Version License

Installation

Run command

composer require black-lamp/yii2-slider

or add

"black-lamp/yii2-slider": "*"

to the require section of your composer.json.

Applying migrations

yii migrate --migrationPath=@vendor/black-lamp/yii2-slider/src/common/migrations

Add module to application config

Module for backend

'modules' => [
     // ...
     'slider' => [
         'class' => bl\slider\backend\Module::class
     ]
]

Module configuration properties

Option Description Type Default
imagesRoot Path to images catalog in web folder (need for uploading images to the server across dashboard) string @frontend/web/img/slider
urlSeparator Separator for getting url to image from image path string web
imagePrefix Prefix for uploaded images (need for uploading images to the server across dashboard) string slider

Using

You should use the widget for adding the slider to the page

<?= bl\slider\frontend\widgets\SliderWidget::widget([
        'sliderKey' => 'home-page-slider'
    ]) ?>

Widget configuration properties

Option Description Type Default
sliderKey Unique slider key string -
imagePattern Pattern for image string <div style="background: url({url}) {params} no-repeat; background-size: cover; height: 400px;"></div>
slickSliderOptions Slider plugin configuration array.For more information read official Slick slider documentation. array ['slidesToShow' => '3', 'slidesToScroll' => '1', 'autoplay' => 'true', 'autoplaySpeed' => '2000']

Also you can append this slider to your Active Record model

Configuration

Add behavior to your Active Record model

use yii\db\ActiveRecord;

/**
 * @property string $sliderKey
 * @property SliderContent[] $sliderContent
 */
class Article extends ActiveRecord
{
    public function behaviors()
    {
        return [
            // ...
            'slider' => [
                'class' => \bl\slider\common\behaviors\SliderBehavior::class
            ],
        ];
    }
}

Using

$article = new Article();
$article->sliderKey = "article-slider";

$slide_one = new SliderContent();
$slide_one->content = "img/slider/slider-1.jpg";
$slide_one->position = 1;

$slide_two = new SliderContent();
$slide_two->content = "img/slider/slider-2.jpg";
$slide_two->position = 2;

// slide N...

$article->sliderContent = $slide_one;
$article->sliderContent = $slide_two;
// or
$article->sliderContent = [$slide_one, $slide_two];

$article->save();

统计信息

  • 总下载量: 180
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2016-10-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固