A flash message is said on one request and shown on the next: the page that took a post calls padFlash ( 'Thanks, your message was sent.' ) and redirects, and the page the browser lands on shows it with {flash}. That is the post-redirect-get pattern, without a ?sent=1 in the address that anyone could put in a link.

{flash} iterates the messages of this request, one occurrence each, with {$message} and {$type} - padFlash's second argument, info by default. {flash 'error'} takes only the messages of that type and leaves the others for a later {flash}. No message, and the @else@ half renders.

Each message is shown once: a second {flash} does not show it again. A message lives exactly one request after the one that flashed it, shown or not; one flashed during this very request shows at once, as in the examples here. A padFlash cookie tells the next request there is something to take, so pages of an application that never flashes do not open the session.