<?php

/**
 *
 * INDEXU
 * Copyright(C), Nicecoder, 2000-2006, All Rights Reserved.
 *
 * INDEXU(tm) is protected by Indonesia and International copyright laws.
 * Unauthorized use or distribution of INDEXU(tm) is strictly prohibited,
 * violators will be prosecuted. To obtain a license for using INDEXU(tm),
 * please register at Nicecoder home page at http://www.nicecoder.com
 *
 * Author:
 *    Dody Rachmat Wicaksono (dody@nicecoder.com)
 *    M. Zuber (zubby@nicecoder.com)
 *
 */

function block_rss_feed($params) {
  global $base_path;

  include_once $base_path . "lib/rss.class.php";

  if (!$params['template']) {
    $params['template'] = 'block.rss_feed.html';
  }

  $tpl = new Template;

  if (isset($params['cache_time'])) {
    $rss = new rss($params['url'], $params['title'], $params['cache_time']);
  }
  else {
    $rss = new rss($params['url'], $params['title']);
  }
  if (!@count($rss->items)) {
    return;
  }
  $tpl->assign("title", $params['title']);
  $tpl->assign("items", $rss->items);
  $tpl->assign("max_item", (!$params['max_item']) ? 1000 : $params['max_item']);
  $tpl->display("blocks/" . $params['template']);
}

?>