PHP Classes

Flash Alerts: Register and display alert messages using sessions

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 113 All time: 9,598 This week: 455Up
Version License PHP version Categories
flash-alerts 1.0.0Custom (specified...5HTML, PHP 5
Description 

Author

This is a simple class can register and display alert messages using sessions.

It takes a given text for an alert message and stores it in a session variable and redirects the browser to a given page.

The class will also return the previously set alert by retrieving it from the session variable.

Picture of Ruben Villegas
Name: Ruben Villegas <contact>
Classes: 1 package by
Country: Mexico Mexico
Age: ???
All time rank: 437955 in Mexico Mexico
Week rank: 178 Up4 in Mexico Mexico Up

Documentation

Flash alerts

This is a really simple and easy script for creating alert box using Bootstrap with a custom message and sytle. If you want to display an alert box after a completed form or some action you can use this.

How to use

Use this is really simple. Just follow the next steps.

1- Always start a session and include it:

Its really important start and destroy the sessions.

session_start(); // at the top of the script/page
include 'path/to/alerts.php';
$alerts = new alerts();

//your code page.....

session_destroy(); // at the bottom of the script/page

2- Creating the alert

Before displaying you must create it. This work as a function call.

$alerts->create('Thanks for use this', 'info', '/page.php');

This function creata a session called "flash" that store the div with the parameters. If the session is created and everything its okay, it will redirect to "/page.php".

3- Displaying the alert

Once is included and the sessions are started you must load it.

$alerts->display();
//will display <div class="alert alert-info">Thanks for use this</div>

  Files folder image Files (3)  
File Role Description
Plain text file alerts.php Class Class source
Accessible without login Plain text file LICENCE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:113
This week:0
All time:9,598
This week:455Up