Giter Site home page Giter Site logo

message's Introduction

Message

A flash messaging system for Kohana v3.0 and higher.

To use, download the source, extract and rename to message. Move that folder into your modules directory and activate in your bootstrap.

Usage

To set a flash message all it takes is the following

Message::set( type, message );

type: Use a constant that can be found below message: A message string or array of message strings

When you need to get a message you can: echo Message::display(); or echo Message::render();

Messages

There are 4 constants you can use to set a message

Message::ERROR = 'error'
Message::SUCCESS = 'success'
Message::NOTICE = 'notice'
Message::WARN = 'warn'

Style

The message class produces the following code by default

    <li class"type">Message ... Repeated if an array

To style, set #message and the classes for the constants .error, .success, .notice, .warn


Sample Usage

I get the most mileage from this class when validating forms. Here is a quick example.

$validation = new Validate($_POST);
$validation->rule(.....) <-- Add rules

if( $validation->check() )
{
	// Validation passed
	Message::set( Message::SUCCESS, 'Form Success!' );
}
else
{
	// Validation failed
	Message::set( Message::ERROR, $validation->errors('_form_');
}

message's People

Contributors

davewid avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.