diff --git a/IBlockTools.php b/IBlockTools.php new file mode 100644 index 0000000..bb12322 --- /dev/null +++ b/IBlockTools.php @@ -0,0 +1,43 @@ +initCache(3600, $cacheId)) { + return $cache->getVars(); + } elseif ($cache->startDataCache(3600, $cacheId, '/' . SITE_ID . '/' . 'cachedElements')) { + $sort = $params['sort'] ? : array('SORT' => 'ASC'); + $filter = $params['filter'] ? : array(); + $select = $params['select'] ? : array(); + $result = array(); + $dbElements = CIBlockElement::GetList( + $sort, + $filter, + false, + false, + $select + ); + while ($element = $dbElements->Fetch()) { + $result[] = $element; + } + $cache->endDataCache($result); + return $result; + } + } +} diff --git a/getLastNews.php b/getLastNews.php new file mode 100644 index 0000000..281c3ca --- /dev/null +++ b/getLastNews.php @@ -0,0 +1,36 @@ +#!/usr/bin/php +xpath('//item') as $news) { + if ($newsCounter < $newsLimit) { + printf("%u. %s\r\n", $newsCounter + 1, str_repeat('=', 50)); + printf("%s\r\n", htmlspecialchars(strip_tags(trim((string) $news->title)))); + printf("%s\r\n", htmlspecialchars(strip_tags(trim((string) $news->link)))); + printf("%s\r\n", htmlspecialchars(strip_tags(trim(((string) $news->description))))); + printf("%s\r\n", str_repeat('=', 50)); + echo "\r\n"; + $newsCounter++; + } else { + break; + } +} +foreach ($result as $item) { + +} + +require($_SERVER["DOCUMENT_ROOT"] . "bitrix/modules/main/include/epilog_after.php"); +?>