Joomla 2.5中的系统消息成功

时间:2013-01-13 09:44:49

标签: joomla system backend

我在后端开发了一个组件,现在我遇到了一个问题,我在数据更新后看不到系统消息。我想我错过了一些消息框或一些代码,但仍无法准确定义它是什么。谁能告诉我哪些数据是获取这些消息所必需的?

1 个答案:

答案 0 :(得分:1)

// 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');

enqueueMessage函数的第二个参数是消息的类型。默认值为“message”,但“error”会导致邮件的样式不同。系统会显示消息,代替模板中的特殊jdoc:include语句。将以下内容放在模板中要显示消息的位置。

<jdoc:include type="message" />

Read more