diff --git a/GetList b/GetList new file mode 100644 index 0000000..d1139e6 --- /dev/null +++ b/GetList @@ -0,0 +1,30 @@ + "ASC"), $pageParams = false) + { + if (!CModule::IncludeModule("iblock")) return false; + if (empty($Filter)) return false; + $arResult = false; + $obCache = new CPHPCache; + $life_time = 3600; + $cache_params = $Filter; + $cache_params['func'] = 'CIBlockElement::GetList'; + $cache_params['arSelect'] = $arSelect; + $cache_params['sort'] = $sort; + $cache_params['pageParams'] = $pageParams; + $cache_id = md5(serialize($cache_params)); + if ($obCache->InitCache($life_time, $cache_id, "/")) : + $arResult = $obCache->GetVars(); + else : + $ElList = CIBlockElement::GetList($sort, $Filter, false, $pageParams, $arSelect); + while ($arElement = $ElList->GetNext()) { + $arResult[] = $arElement; + } + endif; + if ($obCache->StartDataCache()): + $obCache->EndDataCache($arResult); + endif; + return $arResult; + } +} diff --git a/getLastNews.php b/getLastNews.php new file mode 100644 index 0000000..de2e5f7 --- /dev/null +++ b/getLastNews.php @@ -0,0 +1,20 @@ + +5){ + array_pop($arRes["item"]); +} +array_walk_recursive($arRes, create_function('&$val, $key', '$val=htmlspecialcharsex($val);')); +//array_walk_recursive($arRes, create_function('&$val, $key', '$val=str_replace(array(" ", "\\r\\n"), array("    ", "
"), HTMLToTxt($val));')); +foreach($arRes["item"] as $i=> $item){ + echo '

'.$i.'.'.$item['title'].'
'.$item['link'].'
'.$item['description'].'


'; +} +?>