diff --git a/getLastNews.php b/getLastNews.php new file mode 100644 index 0000000..0a77ee7 --- /dev/null +++ b/getLastNews.php @@ -0,0 +1,29 @@ +message . "\n"; + } + die(); +} +$counter = 0; +foreach($xml->channel->item as $item) { + + if($counter >= 5) { + break; + } + + echo "\n\n----" . ($counter + 1) . "----\n\n"; + echo (string)$item->title . "\n"; + echo (string)$item->link . "\n"; + echo (string)$item->description . "\n"; + + $counter++; +} + +echo 'done!'; + +?> \ No newline at end of file diff --git a/local/php_interface/classes/Element.php b/local/php_interface/classes/Element.php new file mode 100644 index 0000000..8b9d5c8 --- /dev/null +++ b/local/php_interface/classes/Element.php @@ -0,0 +1,52 @@ +_cached)) { + return $this->_cached[$hash]; + } + + $rsElement = \CIBlockElement::GetList( + is_array($arParams['sort']) ? $arParams['sort'] : [], + is_array($arParams['filter']) ? $arParams['filter'] : [], + false, + false, + is_array($arParams['select']) ? $arParams['select'] : [] + ); + while($arElement = $rsElement->GetNext()) { + // если это инфоблок 1.0 (свойства лежат в общей таблице), то + // элементы будут дублироваться при выборке значений множ. свойства + // в задании про это ничего не сказано. + $arReturn[] = $arElement; + } + + $this->_cached[$hash] = $arReturn; + + return $arReturn; + } + +} +?> \ No newline at end of file diff --git a/local/php_interface/init.php b/local/php_interface/init.php new file mode 100644 index 0000000..319f820 --- /dev/null +++ b/local/php_interface/init.php @@ -0,0 +1,5 @@ + \ No newline at end of file