User Tools

Site Tools


library:notices

Library:Notices

Notices are messages that outputs to the user upon a complete page render. After output notices are emptied.

There are 4 different types of notices:

  • Success
  • Notices
  • Warnings
  • Errors

A notice can be stored in the message stack by the following command:

notices::add('errors', 'message');
notices::add('notices', 'message');
notices::add('success', 'message');
notices::add('warnings', 'message');

You can also access the actual data array where they are stored:

$system->notices->data['success'][] = 'your message'; // 1.0.x
notices::$data['success'][] = 'your message'; // 1.1+

LiteCart makes use of notices before making changes to data like when validating form data:

if (empty($_POST['name'])) notices::$data['errors'][] = 'You must enter a name';

if (empty(notices::$data['errors'])) {
  // Do some magic
}

Templates

The placeholder for notices is a snippet named notices. Use the following snippet in your template file:

<!--snippet:notices-->
library/notices.txt · Last modified: 2013/12/31 06:07 by 193.14.28.120