Answer the question
In order to leave comments, you need to log in
Why might the "BeforeIndexHandler" handler not be called?
Why might the "BeforeIndexHandler" handler not be called? I take the handler declaration from the official site, the code (init.php) is as follows:
AddEventHandler("search", "BeforeIndex", "BeforeIndexHandler");
function BeforeIndexHandler($arFields) {
echo("проверка");
}
Answer the question
In order to leave comments, you need to log in
What should work here? Take the example and check on the news block
<?
// file /bitrix/php_interface/init.php
// register handler
AddEventHandler("search", "BeforeIndex", Array("MyClass", "BeforeIndexHandler"));
class MyClass
{
// create a "BeforeIndex" event handler
function BeforeIndexHandler($arFields)
{
if($arFields["MODULE_ID"] == "iblock" && $arFields["PARAM2"] == 33)
{
if(array_key_exists(" BODY", $arFields))
{
$arFields["BODY"] .= "latest news";
}
}
return $arFields;
}
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question