CAdvBanner::SetRequiredKeywords( mixed keywords, varchar(255) TYPE_SID="" );
The method assigns a set of required keywords to a given page. If all of the banner or contract keywords are found within a page, the probability of show of the banner is higher. In case no banner satisfying the keyword set can be found, a banner for the show is selected from those without any keywords.
Parameter | Description |
---|---|
keywords | Keywords. See Remarks for description of information types that can be passed in this parameter. |
TYPE_SID | Type identifier. Describes the advertisement type to which the keywords are to be assigned. Leave this parameter empty to assign keywords to all types. |
The following is an example of using the method in the real page.
<? require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); if (CModule::IncludeModule("advertising")) { // required exact match keywords $arrKeywords = array(); $arrKeywords[] = array("EXACT_MATCH" => "Y", "KEYWORD" => "GeForce"); $arrKeywords[] = array("EXACT_MATCH" => "Y", "KEYWORD" => "video"); CAdvBanner::SetRequiredKeywords($arrKeywords, "LEFT"); // required fuzzy match keywords CAdvBanner::SetRequiredKeywords(array("Ford", "BMW", "Lada"), "RIGHT"); } $APPLICATION->SetTitle("Title"); require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_after.php"); // page body require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog.php"); ?>
Global use in prolog_after.php:
<? if (CModule::IncludeModule("advertising")) { CAdvBanner::SetRequiredKeywords($APPLICATION->GetProperty("keywords")); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> ...
If a page contains keywords, the following two scenarios are possible.
Please remember that a full list of banner keywords is comprised by both banner keywords and keywords of a contract to which the banner is attached.
Structures that can be passed in the keywords
parameter include
the following.
Array ( [0] => Array ( [EXACT_MATCH] => Y [KEYWORD] => GeForce ) [1] => Array ( [EXACT_MATCH] => Y [KEYWORD] => Radeon ) )
Array ( [0] => GeForce [1] => Radion [2] => Sony )In this case, the fuzzy match algorithm is applied for searching for matching keywords; search includes all of the required keywords.
"GeForce, Radion, Sony"In this case, the fuzzy match algorithm is also applied for searching for matching keywords.
© 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |