Here you will find the new official reference manuals. These documents are related to the core of TYPO3 and address the built in functionality of TYPO3. They are designed to provide you with in-depth information.
- Coding Guidelines
- Core Api Reference
- File Abstraction Layer
- Inside TYPO3
- TSconfig Reference
- Typoscript Reference
- Typoscript Syntax
- TYPO3 Services
Old Core Documentation
Since TYPO3 4.3 there is a generic system to show users that an action was performed successfully, or more importantly, failed. This system is known as “flash messages”. The screenshot below shows the various severity levels of messages that can be emitted. It also shows that flash messages can include a header or not.
Notifications are used to show very low severity information. Such information usually is so unimportant that it can be left out, unless running in some kind of debug mode.
Information messages are to give the user some information that might be good to know.
OK messages are to signal a user about a successfully executed action
Warning messages show a user that some action might be dangerous, cause trouble or might have partially failed.
Error messages are to signal failed actions, security issues, errors and the like.
Creating a flash message is achieved by simply instantiating an object of class t3lib_FlashMessage:
$message = t3lib_div::makeInstance('t3lib_FlashMessage', 'My message text', 'Message Header', // the header is optionalt3lib_FlashMessage::WARNING, // the severity is optional as well and defaults to t3lib_FlashMessage::OKTRUE // optional, whether the message should be stored in the session or only in the t3lib_MessageQueue object (default is FALSE));
The severity is defined by using class constants provided by t3lib_FlashMessage:
t3lib_FlashMessage::NOTICE for notifications
t3lib_FlashMessage::INFO for information messages
t3lib_FlashMessage::OK for success messages
t3lib_FlashMessage::WARNING for warnings
t3lib_FlashMessage::ERROR for errors
The fourth parameter passed to the constructor is a flag that indicates whether the message should be stored in session or not (the default is not). Storage in session should be used if you need the message to be still present after a redirection.
In backend modules you can then make that message appear on top of the module after a page refresh / the rendering of the next page request or render it on your own where ever you want.
This example adds the flash message at the top of modules when rendering the next request:
The message is added to the queue and then the template class calls t3lib_FlashMessageQueue::renderFlashMessages() which renders all messages from the queue. Here's how such a message looks like in a module:
It is also possible to render a single message directly, instead of adding it to the queue. This makes it possible to display flash messages absolutely anywhere. Here's how this is achieved: