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:
??? ??? ???
Customizing the Page
[ 244 ]
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('An error type message', 'error');
The first parameter is the message that we want to enqueue and the second
parameter is the type of message we want to enqueue , which defaults to message. It
is uncommon to add messages of type notice or error this way because we usually
do that using JError::raiseNotice() and JError::raiseWarning() respectively.
Pages:
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336