| <?php | |
| function & get_news($file_name) { | |
| $file_name = $_SERVER['DOCUMENT_ROOT'] . "/callisto/scripts/" . $file_name . ".rss"; | |
| $rss = simplexml_load_file($file_name); | |
| return $rss; | |
| } | |
| function rss_to_html($file_name, $count=3) { | |
| $rss = get_news($file_name); | |
| ob_start(); | |
| foreach ($rss->channel as $channel) | |
| { | |
| ?> | |
| <div class="homeitem noMarginRight"> | |
| <h3><?=$channel->title;?> | |
| <a href="news.php"><img src="/images/more.gif"></a></h3> | |
| <ul> | |
| <? | |
| foreach ($channel->item as $item) | |
| { | |
| if ($count == 0) break; | |
| $then = strtotime($item->pubDate); | |
| $stringDate = date("M d, Y", $then); | |
| ?> | |
| <li><a href="<?=$item->link;?>"><?=$item->title;?></a></li> | |
| <? | |
| $count--; | |
| } | |
| ?> </div><? | |
| } | |
| $html = ob_get_contents(); | |
| ob_end_clean(); | |
| return $html; | |
| } | |
| function rss_to_html_verbose($file_name, $count=3) { | |
| $rss = get_news($file_name); | |
| ob_start(); | |
| foreach ($rss->channel as $channel) | |
| { | |
| ?> | |
| <h3><a href="/callisto/scripts/whatsnew.rss"><img src="/images/rss.gif" align="right" title="RSS Feed" alt="[RSS]" /></a><?=$channel->title;?></h3><br/> | |
| <ul> | |
| <? | |
| foreach ($channel->item as $item) | |
| { | |
| if ($count == 0) break; | |
| $then = $item->pubDate; | |
| $stringDate = date("M d, Y", $then); | |
| ?> | |
| <li> | |
| <a href="<?=$item->link;?>"><?=$item->title;?></a> posted <?=$stringDate;?><br/><br/><?=$item->description;?><br/><br/> | |
| </li> | |
| <? | |
| $count--; | |
| } | |
| ?> | |
| </ul> | |
| <? | |
| } | |
| $html = ob_get_contents(); | |
| ob_end_clean(); | |
| return $html; | |
| } | |
| ?> |