Location: PHPKode > projects > Communication Kit > programs/live/rss_display_inc.php
<?php
  require_once(ROOT.'rss/rss_fetch.inc');

  $sql = mysql_query("SELECT * FROM ".RSS_FEEDS."
  WHERE rss_id = '$page_form_id' ");
  $row = mysql_fetch_array($sql);
  foreach( $row AS $key => $val ){
    $$key = stripslashes( $val );
  }
  //$url = 'http://www.gnpcb.org/esv/share/rss2.0/daily/';
  //$url = 'http://news.bbc.co.uk/rss/newsonline_uk_edition/sci/tech/rss091.xml';

  $rss = fetch_rss( $rss_source );
  $title = (isset($rss->channel['title'])) ? $rss->channel['title'] : "" ;
  $link = (isset($rss->channel['link'])) ? $rss->channel['link'] : "" ;
  $desc = (isset($rss->channel['desc'])) ? $rss->channel['desc'] : "" ;
  $image = (isset($rss->image['url'])) ? $rss->image['url'] : "" ;
  $alt = (isset($rss->image['title'])) ? $rss->image['title'] : "" ;
  $href = (isset($rss->image['link'])) ? $rss->image['link'] : "" ;
  if (($rss_item_bg_color>"")||($rss_item_font_color>"")){
    $item_bg_style = (isset($rss_item_bg_color)) ? "background-color: $rss_item_bg_color; layer-background-color: $rss_item_bg_color;" : "" ;
    $item_font_style = (isset($rss_item_font_color)) ? "color: $rss_item_font_color;" : "" ;
    $item_style_text =  "style=\"$item_bg_style $item_font_style margin:0px; padding:3px;\"";
  } else {
    $item_style_text = 'style="margin:0px; padding:3px;"';
  }
  if (($rss_ch_bg_color>"")||($rss_ch_font_color>"")){
    $ch_bg_style = (isset($rss_ch_bg_color)) ? "background-color: $rss_ch_bg_color; layer-background-color:$rss_ch_bg_color;" : "" ;
    $ch_font_style = (isset($rss_ch_font_color)) ? "color: $rss_ch_font_color;" : "" ;
    $ch_style_text =  "style=\"$ch_bg_style $ch_font_style margin:0px; padding:3px;\"";
  } else {
    $ch_style_text = 'style="margin:0px; padding:3px;"';
  }
  print "<table border=0 cellpadding=0 cellspacing=0>";
  if (($image>"")&&($rss_ch_image)) {
    print "<tr><td class=menu_head $ch_style_text>
    <a href='$href' target='_new' class=mh><img src='$image' alt='$alt'></a></td></tr>";
  }
  if (($rss_ch_link)&&($rss_ch_title)&&(isset($link))&&(isset($title))){
    print "<tr><td class=menu_head $ch_style_text>
    <a href='$link' class=mh>";
    print (isset($include_title_text)) ? "$include_title_text:" : "" ;
    print " $title</a></td></tr>\n";
  } elseif (($rss_ch_title)&&(isset($title))){
    print "<tr><td class=menu_head $ch_style_text>
    $include_title_text: $title</td></tr>\n";
  }
  $count=0;
  foreach ($rss->items as $item) {
    if ($count++==$rss_max_items){
      break;
    }
    $href = $item['link'];
    $title = $item['title'];
    $description = $item['description'];
    if ((isset($item['pubDate']))||(isset($item['pubdate']))){
      $pubDate = (isset($item['pubDate'])) ? $item['pubDate'] : $item['pubdate'];
      $date_text = "(".date("d/m/y", strtotime(substr($pubDate,5))).")";
      $date_text = (substr($date_text,7)=="70)") ? "" : $date_text ;
    } else {
      $date_text = "";
    }
    $author = (isset($item['author'])) ? $item['author'] : "" ;
    if (($rss_item_link)&&($rss_item_title)&&(isset($href))&&(isset($title))){
      print "<tr><td class=menu_head $ch_style_text><a href='$href' target='_new' class=mh>$title $date_text</a></td></tr>\n";
    } elseif (($rss_item_title)&&(isset($title))){
      print "<tr><td class=menu_head $ch_style_text>
      $title</td></tr>\n";
    }
    if (($rss_item_desc)&&(isset($description))){
      print "<tr><td class=menu $item_style_text>$description</td></tr>\n";
    }
    if (($rss_item_author)&&(isset($author))){
      print "<tr><td class=menu $item_style_text>$author</td></tr>\n";
    }
    if (($rss_item_date)&&(isset($pubDate))){
      print "<tr><td class=menu $item_style_text>".date("d/m/Y", strtotime($pubDate))."</td></tr>\n";
    }
  }
  print "</table>";
?>
Return current item: Communication Kit