定制 isa/cmessage 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

isa/cmessage

Composer 安装命令:

composer require isa/cmessage

包简介

Class to show flash messages

README 文档

README

Alt text

CMessage

Module for session-based Flash Messages that handels messages for error, success and information. If you are using Anax/MVC use the class CMessageAnax.

License

This software is free software and carries a MIT license.

How to use

Session must be started before including CMessage.

Include CMessage by adding this lines:

$di->set('message', function() {
	$message = new \Isa\CMessage\CMessage();
	return $message;
});

If you are using Anax/MVC include CMessage with this lines:

$di->set('message', function() use ($di) {
	$message = new \Isa\CMessage\CMessageAnax($di);
	return $message;
});

Simply add the desired messages by adding these lines:

For error-messages:

$app->message->addErrorMessage('This is a error-message');

For success-messages:

$app->message->addSuccessMessage('This is a success-message');

For information-messages:

$app->message->addInfoMessage('Detta är ett infomeddelande');

This lines will save the message/messages in the session and when you want to print out the messages call the method printMessage:

$app->message->printMessage();

For example you could place the messages in a variable like this:

$messages = $app->message->printMessage();

and then use this line to print it out on a page:

$app->views->addString($messages); 

The messages are using icons from Font Awesome. If you want to include icons in your messages just download Font Awesome from http://fortawesome.github.io/Font-Awesome/ and place it in your project. Then make the project use the css-file, for example like this:

$app->theme->addStylesheet('css/font-awesome/css/font-awesome.css');

If you dont want to use the icons the messages will look fine even without them.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-09