Hotaru has functions which fade in a red or green div with a given message on it. There are three ways to display messages:
Show a single message
Longhand:
PHP Code:
$h->message = "This is a message";
$h->messageType = "green";
$h->showMessage();
messageType can only be "green" or "red".
Shorthand:
PHP Code:
$h->showMessage("This is a message", "green");
The default messageType is "green" anyway, so you can omit it from the function call if you like.
Show multiple messages
You can repeat the above to show multiple messages, but problems arise if you assign messages before loading a page, but want to show them later within the body of a page. In that case, only the last message will be shown. The solution is to store them in an associative array like this:
PHP Code:
$h->messages['This is a success message'] = "green";
$h->messages['This is an error message'] = "red";
$h->showMessages();
Notice that we're using messages in our array name and function call.
Bookmarks