PHP code example of esit / messagetoolbox
1. Go to this page and download the library: Download esit/messagetoolbox library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
esit / messagetoolbox example snippets
class MyClass {
public function __constructor() {
$this->sessMsg = \Contao\System::getContainer()->get(\Esit\Messagetoolbox\Classes\Services\SessionMessage::class);
}
public function setMessage() {
$this->sessMsg->addMessage('languageKey_or_message');
}
public function getMessages() {
$sm = \Contao\System::getContainer()->get(\Esit\Messagetoolbox\Classes\Services\SessionMessage::class);
$messages = $this->sessMsg->getMessages();
$this->sessMsg->deleteMessages(); // Delete all Messages!
var_dump($messages); // Array of Messages!
}
public function outputMessages() {
echo $this->sessMsg->ouput(); // Output string with default template AND DELETES ALL MESSAGES!
}
}
$GLOBALS['TL_LANG']['MSC']['messagetoolbox']['output']['languageKey_or_message'] = 'Toller Nachrichtentext!';