Bitrix Site Manager

CAdminMessage::CAdminMessage

object
CAdminMessage(
 array $arMessage[, 
 mixed $exception = false]
)

The CAdminMessage class constructor.

Parameters

Parameter Description
arMessage An array with the following keys:
  • MESSAGE - the message text;
  • TYPE - the message type ("ERROR" - error message; "OK" - notification);
  • DETAILS - the detailed description;
  • HTML - if true, the error message is HTML and should be rendered as is.
exception The CApplicationException class instance which provides the error description in case it is not specified in arMessage.

Example:


if($strError) 
{
  $aMsg = array();
  $arrErr = explode("<br />",$strError);
  reset($arrErr);
  while (list(,$err)=each($arrErr)) $aMsg[]['text']=$err;

  $e = new CAdminException($aMsg);
  $GLOBALS["APPLICATION"]->ThrowException($e);
  $message = new CAdminMessage(GetMessage("FORM_ERROR_SAVE"), $e);
  echo $message->Show();
}