Actions

API15

Difference between revisions of "JApplication/enqueueMessage"

From Joomla! Documentation

< API15:JApplication
(New page: ===Description=== Enqueue a system message. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</n...)
 
Line 36: Line 36:
 
===Source Body===
 
===Source Body===
 
<source lang="php">
 
<source lang="php">
public function enqueueMessage($msg, $type = 'message')
+
function enqueueMessage( $msg, $type = 'message' )
 
{
 
{
         // For empty queue, if messages exists in the session, enqueue them first.
+
         // For empty queue, if messages exists in the session, enqueue them first
 
         if (!count($this->_messageQueue))
 
         if (!count($this->_messageQueue))
 
         {
 
         {
                 $session = &JFactory::getSession();
+
                 $session =& JFactory::getSession();
 
                 $sessionQueue = $session->get('application.queue');
 
                 $sessionQueue = $session->get('application.queue');
 
                 if (count($sessionQueue)) {
 
                 if (count($sessionQueue)) {
Line 48: Line 48:
 
                 }
 
                 }
 
         }
 
         }
         // Enqueue the message.
+
         // Enqueue the message
 
         $this->_messageQueue[] = array('message' => $msg, 'type' => strtolower($type));
 
         $this->_messageQueue[] = array('message' => $msg, 'type' => strtolower($type));
 
}
 
}

Revision as of 17:09, 22 March 2010

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Enqueue a system message.

[Edit Descripton]

Description:JApplication/enqueueMessage

Syntax

enqueueMessage($msg, $type= 'message')
Parameter Name Default Value Description
$msg $msg The message to enqueue.
$type 'message' $type The message type.

Returns

void

Defined in

libraries/joomla/application/application.php

Importing

jimport( 'joomla.application.application' );

Source Body

function enqueueMessage( $msg, $type = 'message' )
{
        // For empty queue, if messages exists in the session, enqueue them first
        if (!count($this->_messageQueue))
        {
                $session =& JFactory::getSession();
                $sessionQueue = $session->get('application.queue');
                if (count($sessionQueue)) {
                        $this->_messageQueue = $sessionQueue;
                        $session->set('application.queue', null);
                }
        }
        // Enqueue the message
        $this->_messageQueue[] = array('message' => $msg, 'type' => strtolower($type));
}

[Edit See Also] SeeAlso:JApplication/enqueueMessage

Examples

<CodeExamplesForm />