Loading...
May 31, 2010#

Displaying Error Messages in Joomla

I found this code quite handy when developing components and displaying error messages to users.

//Get a handle to the Joomla! application object
$app =& JFactory::getApplication();
//add a message to the message queue
$app->enqueueMessage( JText::_( 'Some error occurred' ), 'error' );

/** Alternatively, in PHP 5 */
JFactory::getApplication()->enqueueMessage( JText::_( 'Some error occurred' ), 'error' );

Leave a Comment