WIKINDX METHODS

Method:
text()

Class:
ERRORS
or
MESSAGES

Method Call:
include_once("core/messages/ERRORS.php");
$message = new ERRORS();
OR
include_once("core/messages/MESSAGES.php");
$message = new MESSAGES();
STRING $message->text(STRING: $arrayName, STRING: $indexName, [STRING: $extra]);

Description:
Called via one of several classes within core/messages/, this method will return a properly formatted error message, text message etc. that has been selected from an array of strings within that class depending on the language chosen at setup. The string returned is parsed by PHP's htmlspecialchars() function.

$arrayName is the name of the selected array and $indexName is the key of a particular element in that array. The optional $extra is a string that provides more specific information on the error/message and is included in the formatted return string.

Usage:
For example, if ERROR::en() has an array called inputError consisting of the following:
	array(
		"nan"		=>	"### is not a number.",
		"missing"	=>	"Missing input.###",
		"invalid"	=>	"Invalid input.###",
	);
then
	include_once("core/messages/ERRORS.php");
	$error = new ERRORS();
	$pString = $error->text("inputError", "missing", " (Superadmin Password) ");
will return the formatted string:
	Missing input. (Superadmin Password)

(Any occurrence of '###' in the array element value is replaced by the optional string $extra or "" if $extra does not exist.)

WIKINDX home      WIKINDX usage      WIKINDX classes