} if ($output == '') { //cache is off OR have no cache OR it's STALE //use system class Snoopy //this class is used in manager panel to show news on startpage. require_once $basePath . 'manager/media/rss/extlib/Snoopy.class.inc'; $client = new Snoopy(); $client->agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 GTB7.1'; $client->read_timeout = '10'; $client->use_gzip = true; $datas = array(); foreach ($urls as $url) { //that's it! $client->fetch($url); //parse xml $data = RSS::parse($client->results, $url, $more); //merge results $datas = array_merge($datas, $data); } //sort results by date usort($datas, 'RSS::date_sort'); //cut some items $datas = array_splice($datas, 0, $num); //parse template and collect results $outputs = array(); foreach ($datas as $param) { //translate rss date (Fri, 01 Apr 2011 14:13:08 +0400) to readable view //need $dateFormat. If no $dateFormat - don't touch date $param[date] = RSS::format_date($param[date], $dateFormat); if ($tpl) { //has chunk