$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
         array_push($outputs, $modx->parseChunk($tpl, $param, '[+', '+]'));
     } else {
         //no chunk, use default template
         array_push($outputs, RSS::parse_tpl($default_tpl, $param));
     }
 }
 //join results to string
 $output = implode($outputs, "\n\n");
 //if cache is on
 if ($cacheAge) {
     //store cache for future generations!
     $cache->set($baseurl, $output);
 }