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/developerTest b/developerTest new file mode 160000 index 0000000..dc10fb8 --- /dev/null +++ b/developerTest @@ -0,0 +1 @@ +Subproject commit dc10fb8a2a6a58490ca1fecaa26e5a1d33b3b284 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