tomas / message
Message handling plugin
v1.0
2016-02-19 13:21 UTC
Requires
- php: >=5.4
This package is not auto-updated.
Last update: 2025-05-16 21:36:56 UTC
README
This is a simple Message plugin that will store message via Session and display it for a given interval. Support for several message bubbles.
- Include
- message.js
- message.css
- Message.php
- Include the file wherever you may want to start a message and also where you want to output message.
##Simple SET and GET
- setMessage(your message)
- accepts array only
- ['type', 'msg']
- Type either "ok" or "error"
- Msg the wanted message to display
- getMessage() *outputs the message
##Use with Anax-MVC
- Js and Css files
- message.js
- put into webroot/js
- include that JS-file in your Theme
- message.css
- put into webroot/css
- include that CSS-file in your Theme
- PHP file
- Change Namespace in Message.php file
- Load Message.php in CDIFactory
- Create custom CDIFactory
<?php namespace -Your namespace- use Anax\DI\CDIFactoryDefault; use tomas\Message\Message; class CDIFactory extends CDIFactoryDefault { public function __construct() { parent::__construct(); $this->set('message', function() { $message = new Message(); return $message; }); } } ?>
- Change file "config_with_app.php"
- Change to CDIFactory instead of default
- Add $app->session();
- index.php (or choosen router)
- furthest down, under "$app->theme->render();" add "$app->message->getMessage()"
Drop me a mail tomas.sjosten@gmail.com if you want to give me some feedback.