From ac3f557c887f315dc5a1cd6ba70787f5629ab270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D0=B0=D1=80=D0=B8=D0=BA?= <Гарик@192.168.0.102> Date: Mon, 24 Sep 2018 21:28:58 +0500 Subject: [PATCH 1/2] =?UTF-8?q?=D0=A2=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=20=D0=BE?= =?UTF-8?q?=D1=82=20=D0=A1=D0=BE=D1=82=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=20=D0=98=D0=B3=D0=BE=D1=80=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- developerTest | 1 + 1 file changed, 1 insertion(+) create mode 160000 developerTest diff --git a/developerTest b/developerTest new file mode 160000 index 0000000..dc10fb8 --- /dev/null +++ b/developerTest @@ -0,0 +1 @@ +Subproject commit dc10fb8a2a6a58490ca1fecaa26e5a1d33b3b284 From 1090bc3e58f126b76af1155823d129ce7c94befe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D0=B0=D1=80=D0=B8=D0=BA?= <Гарик@192.168.0.102> Date: Mon, 24 Sep 2018 21:42:26 +0500 Subject: [PATCH 2/2] =?UTF-8?q?=D0=A2=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=20=D0=BE?= =?UTF-8?q?=D1=82=20=D0=A1=D0=BE=D1=82=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=20=D0=98=D0=B3=D0=BE=D1=80=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PWD.php | 34 ++++++++++++++++++++++++++++++++++ getLastNews.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 PWD.php create mode 100644 getLastNews.php diff --git a/PWD.php b/PWD.php new file mode 100644 index 0000000..9f5f2b1 --- /dev/null +++ b/PWD.php @@ -0,0 +1,34 @@ + 0 && $obCache->InitCache($cache_time, $cache_id,"/")){ + $vars = $obCache->GetVars(); + $arResult = $vars[$cache_id]; + } elseif ($obCache->StartDataCache() && CModule::IncludeModule("iblock")) { + $res = CIBlockElement::GetList( + $sort, + $filter, + false, + false, + $select + ); + while ($ob = $res->Fetch()) { + if ($ob["PREVIEW_PICTURE"]) $ob["PREVIEW_PICTURE"] = CFile::GetPath($ob["PREVIEW_PICTURE"]); + if ($ob["DETAIL_PICTURE"]) $ob["DETAIL_PICTURE"] = CFile::GetPath($ob["DETAIL_PICTURE"]); + if ($ob["DETAIL_PAGE_URL"]) $ob["DETAIL_PAGE_URL"] = CIblock::ReplaceDetailUrl($ob['DETAIL_PAGE_URL'], $ob, false, 'E'); + $arResult[$ob["ID"]] = $ob; + } + $obCache->EndDataCache(array($cache_id => $arResult)); + } + return $arResult; + } +} + +//$res = PWD::getElems(array(),array("IBLOCK_ID"=>1)); +?> \ No newline at end of file diff --git a/getLastNews.php b/getLastNews.php new file mode 100644 index 0000000..01bc80d --- /dev/null +++ b/getLastNews.php @@ -0,0 +1,42 @@ +IncludeComponent("bitrix:rss.show","",Array( + "URL" => "https://lenta.ru/rss", + "OUT_CHANNEL" => "N", + "PROCESS" => "NONE", + "NUM_NEWS" => "5", + "CACHE_TYPE" => "A", + "CACHE_TIME" => "3600" + ) +); +*/ + + +//Но мне нравится вот так +// http://joxi.ru/YmEdMOi0z69Rr6 + +$url = "https://lenta.ru/rss"; + +$rss = simplexml_load_file($url); +if ( $rss === false ) die('Error parse RSS: '.$url); +$c = 1; +$dm = str_repeat('-',100); +foreach ($rss->channel->item as $item) { + if ($c <= 5) { + $ar = [ + $c.'. '.$item->title, + $dm, + $item->link, + $dm, + $item->description, + $dm, + '' + ]; + echo implode(PHP_EOL,$ar);//PHP_EOL т.к. вызов будет из консоли + $c++; + } else break; +} +?> \ No newline at end of file