(5) Using Flashs :-
we will talk about :-
  • What is flashs ?
  • How to use flashs ?
  • Use flashs example.

(1) What is flashs ?

The flash is a method to send messages to the UI (User Interface) ...

How To Use Flash ?
Use {Flash(cType,Cmessage)} to Send flash to templates...
This function take two parameters :-
  • Ctype:- The type of the message 'success','danger','info' ...
  • Cmessage :- The Message that you want to send.
Example :-
In the route.ring we have this code
#!ring -cgi 
load 'dragon-ring.ring'
import system.Web
app.route('testflash',:ringfile,'testflash.ring')

In the website/testflash.ring we have this code :
import system.web
if isNameFound('btn')
   flash('success','You have clicked on the button')
   flash('danger','Testing the danger Type !')
else
   flash('danger','You have not clicked on the button')
ok
dring{
  html(template('testflash.html',self))
}


In the website/templates/testflash.html we have this code
{%=showflash()%}
<form>
    <button name='btn'>Click Me</button>
</form>

Note:- You can use ShowFlash() or Get_Flashed_Messages() functions to show all messages that you sent...


Note:- The Flash types are :-

  • primary .
  • secondary .
  • success .
  • danger .
  • dangerous .
  • warning .
  • info .
  • light .
  • dark .

I hope it was easy for you ...