Documentation

OnSearchGetURL

string
handler function( array arFields );

"OnSearchGetURL" event is called when formatting an element in the search results from the CSearch::Fetch method and when creating Google Sitemap CSiteMap::Create. Presently, this event is called only for parametrized URLs.

Parameters

Parameter Description
arFields Array that describes a search index element.

Returned value

Handler function can apply formatting to a URL element. And the value must be returned even if the formatting was not applied.

See Also

  • CSearch::Fetch
  • CSiteMap::Create
  • Example of handler function:

    <?
    //init.php

    // register the "OnSearchGetURL" event handler of the "search" module
    AddEventHandler("search", "OnSearchGetURL", array("CMyClass", "OnSearchGetURL"));

    class CMyClass
    {
    public static function OnSearchGetURL($arFields)
    {
    $url = str_replace("#MY_SID#", md5(rand()), $arFields["URL"]);
    return $url;
    }
    }

    ?>


© «Bitrix24», 2001-2024
Up