<? $arFilter = [
"DATE1" => date("d.m.Y", strtotime("-2 month")),
"DATE2" => date("d.m.Y"),
"DIR" => "Y",
"URL" => "http://yacontext.com/" . $arResult['DETAIL_PAGE_URL'],
"URL_EXACT_MATCH" => "Y"
];
$rs = CPage::GetList("", ($by = "s_last_date"), ($order = "desc"), $arFilter);
if ($ar = $rs->Fetch()) {
echo $ar["COUNTER"];
} else {
echo "0";
}
?>
<?$resElement = CIBlockElement::GetByID($arResult['ID'])->GetNext();
$value = $resElement;
function RusEnding($n, $n1, $n2, $n5) {
if($n >= 11 and $n <= 19) return $n5;
$n = $n % 10;
if($n == 1) return $n1;
if($n >= 2 and $n <= 4) return $n2;
return $n5;
}
echo $resElement["SHOW_COUNTER"], ' ', RusEnding($resElement["SHOW_COUNTER"], "Человек интересовался товаром", "Человека интересовались товаром", "Человек интересовались товаром");?>
echo $resElement["SHOW_COUNTER"], RusEnding($resElement["SHOW_COUNTER"], "Человек", "Человека", "Человек");?>
<?$resElement = CIBlockElement::GetByID($arResult['ID'])->GetNext();
$value = $resElement;
function RusEnding($n, $n1, $n2, $n5) {
if($n >= 11 and $n <= 19) return $n5;
$n = $n % 10;
if($n == 1) return $n1;
if($n >= 2 and $n <= 4) return $n2;
return $n5;
}
echo RusEnding(print_r($resElement["SHOW_COUNTER"]), "Человек", "Человека", "Человек");?>