From 2a2f32df3b6cf1b7c20f0d63afc6ce753ff2bd33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D0=BE=D0=BB=D0=B8=D1=82=D0=BE=D0=B2?= Date: Tue, 17 Sep 2019 11:31:50 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=D0=BE?= =?UTF-8?q?=D0=B5=20=D0=B7=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/CacheCIBlockElement.php | 25 +++++++++++++++++++++++++ getLastNews.php | 13 +++++++++++++ index.php | 22 ++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 classes/CacheCIBlockElement.php create mode 100644 getLastNews.php create mode 100644 index.php diff --git a/classes/CacheCIBlockElement.php b/classes/CacheCIBlockElement.php new file mode 100644 index 0000000..a163016 --- /dev/null +++ b/classes/CacheCIBlockElement.php @@ -0,0 +1,25 @@ + self::$lifeTime,'cache_joins' => true); + } + return \Bitrix\Iblock\ElementTable::getList($params); + + } + + return false; + + } +} \ No newline at end of file diff --git a/getLastNews.php b/getLastNews.php new file mode 100644 index 0000000..2bf4401 --- /dev/null +++ b/getLastNews.php @@ -0,0 +1,13 @@ + $item) + { + echo 'НАЗВАНИЕ: ' . $item['title'] . "
" . 'ССЫЛКА: ' . $item['link'] . "
" . 'ОПИСАНИЕ: ' .$item['description'] . "

"; + } +} +require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php"); diff --git a/index.php b/index.php new file mode 100644 index 0000000..0aeac75 --- /dev/null +++ b/index.php @@ -0,0 +1,22 @@ + array("ID", "NAME", "PREVIEW_TEXT"), + 'filter' => array("IBLOCK_ID" => 5, "ACTIVE" => "Y"), + 'group' => array(), + 'order'=> array('ID' => 'ASC'), + 'limit'=> 10 +); + + +if ($res = CacheClasses\CacheCIBlockElement::GetList($params)) +{ + while ($arFields = $res->Fetch()) { + echo '
' . print_r($arFields, 1) . '
'; + } +} + +require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php"); \ No newline at end of file From 8b5e96e7752464f06e90b561c281b250488c60a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D0=BE=D0=BB=D0=B8=D1=82=D0=BE=D0=B2?= Date: Tue, 17 Sep 2019 11:36:56 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=D0=BE?= =?UTF-8?q?=D0=B5=20=D0=B7=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/CacheCIBlockElement.php | 1 - getLastNews.php | 1 + index.php | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/classes/CacheCIBlockElement.php b/classes/CacheCIBlockElement.php index a163016..822b243 100644 --- a/classes/CacheCIBlockElement.php +++ b/classes/CacheCIBlockElement.php @@ -3,7 +3,6 @@ class CacheCIBlockElement { - public static $lifeTime = 60; public static function GetList($params) diff --git a/getLastNews.php b/getLastNews.php index 2bf4401..6d46f27 100644 --- a/getLastNews.php +++ b/getLastNews.php @@ -9,5 +9,6 @@ { echo 'НАЗВАНИЕ: ' . $item['title'] . "
" . 'ССЫЛКА: ' . $item['link'] . "
" . 'ОПИСАНИЕ: ' .$item['description'] . "

"; } + } require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php"); diff --git a/index.php b/index.php index 0aeac75..0b25708 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,6 @@ require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php"); require($_SERVER["DOCUMENT_ROOT"]."/test/classes/CacheCIBlockElement.php"); - $params = array( 'select' => array("ID", "NAME", "PREVIEW_TEXT"), 'filter' => array("IBLOCK_ID" => 5, "ACTIVE" => "Y"),