SPLINT Packages Wiki Downloads {} Blog Log In Sign Up

SPLINT

Packages

Wiki

Downloads

{} Blog

Log In


Sign Up

francis94c/toast

v0.0.2 7 0 - 0.0 0 {} 0


×

Are you sure you want to delete this package?

Users will no longer be able to intall this package if you do so.

Description

A library for displaying Toast messages on your website.

README

toast


This library allows you display temporary messages on your Code Igniter websites.

Installation

To install, download and install Splint from https://splint.cynobit.com/downloads/splint and then run the below from your Code Igniter project root

splint install francis94c/toast

Loading

$params = array (
    "toast_class" => "class",
    "timeout"     => 5000
);
$this->load->splint("francis94c/toast", "+Toast", $params, "toaster");

Usage

A simple way to use this library is call the below method

$this->toaster->toast("My Message goes here.", "green-bg", 5000); // ($message, $css_class, $timeout)
// OR
$this->toaster->toast("My message goes here.", 5000); // ($message, $timeout)

The second parameter is a CSS class used to style the background of the toast message.

the class and timeout parameters override the values supplied to the constructor. to use the values supplied to the constructor $params avoid giving the values when you call the toast() function.

You can display multiple toast messages at the same time by calling $toast function as many times as you need.

The image below shows the result of the following code.

$this->toaster->toast("hello", "w3-green", 3000);
$this->toaster->toast("message", "w3-green", 3000);

Toast Sample

There's another way you can make use of this library.

The toast library optionally makes use of Code Igniter's session library to temporarily store messages that would be read when you actually want to display the message. The use case goes like this.

// To latch message.
$this->toaster->latch("My Latched message to later be displayed by calling toast() without arguments.", "class");

// To display latched message.
$this->toaster->toast();

with from CynoBit