Documentation

GetMessage

string
GetMessage(
 string name,
 array Replace=false
);

The function returns corresponding message by its ID in the current language. The language files are used to assign message ID's to message text. A corresponding language file should be included prior to calling this function.

Function parameters

ParameterDescription Available from version
name Message ID. The ID must be unique within the complete product.
Replace Array of "template" => "replacement" pairs. Allows to organize replacement by template.

See Also

Examples of use

<?
IncludeTemplateLangFile(__FILE__);
echo GetMessage("SOME_MESSAGE_CODE");
?>

Replacement of text message by template

Language file:
$MESS["ERROR_MODULE_NOT_FOUND"] = "Error: #MODULE# not found"

Component or module file:

// ...
if (!CModule::IncludeModule("blog"))
{
   ShowError(GetMessage("ERROR_MODULE_NOT_FOUND", Array ("#MODULE#" => "blog")));


© «Bitrix24», 2001-2024