szmnmichalowski/szm-noty 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

szmnmichalowski/szm-noty

Composer 安装命令:

composer require szmnmichalowski/szm-noty

包简介

jQuery plugin to notifications for Zend Framework 2/3

README 文档

README

Software License Build Status Code Coverage

SzmNoty is a Zend Framework 2/3 view helper integerated with jQyert Noty) plugin to render notifications from SzmNotification controller plugin.

Notifications

Installation

You can install this module via composer

1. Add this project into your composer.json

"require": {
    "szmnmichalowski/szm-noty": "dev-master"
}

2. Update your dependencies

$ php composer.phar update

3. Add module to your application.config.php.

return array(
    'modules' => array(
        'Zend\Session',
        'SzmNotification' // <- Add this line
        'SzmNoty' // <- Add this line
    )
);

Configuration

Copy szm-noty/config/noty.local.php.dist file to root config/autoload and rename to noty.local.php (remove .dist extension) Configuration file should looks like this:

return [
    'notifications' => [
        'library_url' => 'https://cdnjs.cloudflare.com/ajax/libs/jquery-noty/2.4.1/packaged/jquery.noty.packaged.min.js',
        'default_options' => [
            'timeout' => 3000,
            'callback' => [
                'afterShow' => 'function() {
                    console.log("Test!")
                }'
            ]
        ],
        'types' => [
            'info' => [
                'type' => 'info',
            ],
            'success' => [
                'type' => 'success',
                'timeout' => 6000,
            ],
            'warning' => [
                'type' => 'warning'
            ],
            'error' => [
                'type' => 'error'
            ],
        ],
    ]
];

default_options - Options for all types of notifications. types - Options for specific type of notifications (success may have different options then error)

Full list of options you can find on http://ned.im/noty/options.html

Usage

If you need detailed informations how to add notification in controller visit SzmNotification module.

In controller:

    public function indexAction()
    {
        $this->notification()->add('info', 'This is info');
        $this->notification()->add('success', 'This is success');
        $this->notification()->add('warning', 'This is warning');
        $this->notification()->add('error', 'This is error');
        ...
    }

Then in your layout or view:

<?= $this->notification()->setIncludeLibrary(true)->renderCurrent(); ?>

In result, you should see notifications as on image above

Available methods

List of available methods:

  • setIncludeLibrary() - If true then link to noty's library will be attached. Use it if you didn't add path to library manually. Default false
  • render(string $type = null, $options = []) - Render notifications from previous request. If no parameters are provided then it displays all notifications with options provided in config file
  • renderCurrent(string $type = null, $options = []) - Same as above with one difference. It render notifications added during this request.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固