Documentation

AddBufferContent

CMain::AddBufferContent(
 callback function,
mixed parameter_1,
mixed parameter_2,
...
mixed parameter_N )

The method is used to create delay functions. Non-static method.

Parameters

ParameterDescription
function Name of the function that is to be delayed. For usual functions, pass the function name in this parameter. For class methods, pass an array having a class name in the first entry and a method name in the second one.
parameter_1
...
parameter_N
Unlimited number of parameters that will be subsequently passed to the function.

If you use the AJAX-mode for components ("AJAX_MODE" => "Y"), you cannot pass an anonymous function as the first parameter. In this case, an error occurs and returns a complete page as a response for AJAX and not a single component. When using function name as a parameter, such issue didn't occur.

See Also

Examples

<? 
function myShowProperty($property_id, $default_value=false)
{
global $APPLICATION;
$APPLICATION->AddBufferContent(Array(&$APPLICATION, "GetProperty"), $property_id, $default_value);
}
?>
<?
function myShowTitle($property_name="title", $strip_tags = true)
{
    global $APPLICATION;
    $APPLICATION->AddBufferContent(Array(&$APPLICATION, "GetTitle"), $property_name, $strip_tags);
}
?>
<?
function myShowPanel()
{
global $APPLICATION;
$APPLICATION->AddBufferContent(Array(&$APPLICATION, "GetPanel"));
}
?>
<?
$my_title = "";

function myShowTitle($t="title"){
   global $APPLICATION;
   echo $APPLICATION->AddBufferContent("myGetTitle");
}

function mySetTitle($t){
   global $my_title;
   $my_title = $t;
}

function myGetTitle(){
   global $my_title;
   return $my_title;
}
?>


© «Bitrix24», 2001-2024
Up