srgg6701
srgg6701

Reputation: 2048

System messages in Joomla 2.5 on success

I developed a component on backend, and now I faced a problem that I can't see a system message after data is updated. I suppose I had missed something like a message box or some code but still can't define exactly what it is. Can anybody tell me which data is necessary to get those messages?

Upvotes: 0

Views: 1400

Answers (1)

Techie
Techie

Reputation: 45124

// Get a handle to the Joomla! application object
$application = JFactory::getApplication();

// Add a message to the message queue
$application->enqueueMessage(JText::_('SOME_ERROR_OCCURRED'), 'error');

/** Alternatively you may use chaining */
JFactory::getApplication()->enqueueMessage(JText::_('SOME_ERROR_OCCURRED'), 'error');

The second argument to the enqueueMessage function is the type of the message. The default is 'message', but 'error' results in a different style for the message. The message will be displayed in place of a special jdoc:include statement in your template. Place the following in your template at the location where you want messages to appear.

<jdoc:include type="message" />

Read more

Upvotes: 1

Related Questions