zf-hipsters/bootstrap-flash-messenger

该包的最新版本(1.02)没有可用的许可信息。

使用 Bootstrap 简单实现的 ZF2 flash messengers。包含易于使用的助手,可为您节省大量时间。

1.02 2013-11-10 09:23 UTC

This package is not auto-updated.

Last update: 2024-09-24 01:02:37 UTC


README

一个简单的模块,使得 flash messengers 与 CakePHP 一样简单。最好的部分是它生成了格式优美的 Bootstrap 提醒信息!

安装

  1. 将以下需求添加到您的项目 composer.json 文件中。

在 "require" 部分

"zf-hipsters/bootstrap-flash-messenger": ">=1.0"
  1. 打开命令行并运行
php ./composer.phar update
  1. 将 'FlashMessenger' 添加到您的 /config/application.config.php 模块中

控制器插件示例

简单的成功(这是默认命名空间)

$this->fm('You have been logged in.');
return $this->redirect()->toRoute('dashboard');

错误

$this->fm('Your username and/or password were incorrect.', 'error');
return $this->redirect()->toRoute('authorize/login');

信息

$this->fm('Something cool happened!', 'info');
return $this->redirect()->toRoute('home');

警告

$this->fm('Careful! Something bad could happen!', 'warning');
return $this->redirect()->toRoute('dashboard');

视图助手示例

默认用法

<?=$this->fm()?>

自定义命名空间

<?=$this->fm('exciting_namespace')?>
<?=$this->fm(array('mynamespace1', 'mynamespace2'))?>

自定义模板

自定义模板和更改标题非常简单!确保 FlashMessenger 在 application.config.php 中列表的顶部。现在,将 vendor/zf-hipsters/bootstrap-flash-messenger/view/flash-messenger 文件夹复制到您的 eg 模块/application/view 文件夹中。

就这样,随心所欲地进行自定义,它们将覆盖默认文件!