From 3438d3647be88160ade0ff821b720406e83a028c Mon Sep 17 00:00:00 2001 From: ViktorR Date: Fri, 28 Jun 2019 18:37:26 +0800 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=B2=D0=B0=20=D1=87=D0=B0=D1=81=D0=B0?= =?UTF-8?q?=20=D0=BF=D0=BE=D1=82=D1=80=D0=B0=D1=82=D0=B8=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class.php | 43 +++++++++++++++++++++++++++++++++++++++++++ getLastNews.php | 15 +++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 class.php create mode 100644 getLastNews.php diff --git a/class.php b/class.php new file mode 100644 index 0000000..478e256 --- /dev/null +++ b/class.php @@ -0,0 +1,43 @@ +InitCache($life_time, $cache_id, "/")){ + $elArr = $obCache->GetVars(); + } elseif($obCache->StartDataCache()) { + $res = CIBlockElement::GetList($sort, $Filter, $arGroupBy, $pageParams, $arSelect); + while($ob = $res->GetNextElement()) + { + $arFields = $ob->GetFields(); + array_push($elArr, $arFields); + } + $obCache->EndDataCache($elArr); + } + return $elArr; + } +} + +$arSelect = Array("ID", "IBLOCK_ID", "NAME", "DATE_ACTIVE_FROM"); +$arFilter = Array("IBLOCK_ID"=>2, "ACTIVE"=>"Y"); +$res = IblockCashed::GetCachedList(Array("NAME"=>"ASC"), $arFilter, false, false, $arSelect); +print_r($res); + + +require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php"); +?> \ No newline at end of file diff --git a/getLastNews.php b/getLastNews.php new file mode 100644 index 0000000..d01f9fb --- /dev/null +++ b/getLastNews.php @@ -0,0 +1,15 @@ +channel->item as $item) { + if ($i > 4) break; + + echo $item->title . "\n"; + echo $item->link . "\n"; + echo $item->description . "\n"; + + $i++; +} +?> \ No newline at end of file