Hotaru Docs

 [həʊdɒks]

Display Success and Failure Messages

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:

$h->message = "This is a message";
$h->messageType = "green";
$h->showMessage();

messageType can be "green", "yellow" or "red".

Shorthand:

$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:

$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.

Getting StartedDesign and LayoutPlugin DevelopmentAdvanced TopicsFunction ReferenceTroubleshooting