You may have noticed that when we raise a notice or a warning, a bar appears across the top of the page containing the notice or warning message. These messages are part of the application message queue.
The application message queue is a queue of messages that are rendered the next time the application renders an HTML view. This means that we can enqueue messages in one request but not show them until a later request.
There are three different core types of message: message
, notice
, and error
. This screenshot depicts how each of the different types of application message is rendered:
So how do we add a new message to the queue? Well it’s quite simple; we use the enqueueMessage()
method in the application. This example demonstrates how we would add all of the messages shown in the previous screenshot to the message queue:
$mainframe->enqueueMessage('A message type message'); $mainframe->enqueueMessage('A notice type message', 'notice'); $mainframe->enqueueMessage...