rndilger Posted December 15, 2008 Share Posted December 15, 2008 Hello everyone. I'm writing a quick app to display rss news feeds on a website (see this page: http://www.indianasheep.com/pages/news.php). The premise here is that I read rss addresses from a text file (rssfeeds.txt), feed them into a third party app that parses the addresses (FeedForAll, rss2html.php), and display only those news items that contain keywords (also read in from a text file, keywords.txt). The output formatting is all controlled by another file (output.php). Ok, with all that being said, my issue is as follows. On my news page (http://www.indianasheep.com/pages/news.php), it keeps displaying the number '1' after each rss channel (after each table). I CANNOT figure out why this '1' is being output! Here is all the relevant code: news.php, the code that displays the news page: <?php $filename = "/home/indiana/public_html/scripts/rss/rssfeeds.txt"; $fp = @fopen($filename, 'rb'); if ($fp) { $rssfeeds = explode("\n", fread($fp, filesize($filename))); } foreach ($rssfeeds as $a) { echo include ("http://www.indianasheep.com/scripts/rss/rss2html.php?TEMPLATE=output.php&XMLFILE=".$a."&MAXITEMS=10")."<br><br>"; } ?> output.php, file used to format the rss news feeds <table width="600"> <tr><td> <table bgcolor="#666666" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="26" height="28"><img src="images/tl.png" width="26" height="28" border="0"></td> <td rowspan="2" align="center" width="548"><a href="~~~FeedLink~~~" style="text-decoration:none;" target="_blank"><h3 style="color:#FFF; padding:5px;">~~~FeedTitle~~~</h3></a></td> <td width="26" height="28"><img src="images/tr.png" width="26" height="28" border="0"></td> </tr> <tr> <td width="26" height="30"><img src="images/bl.png" width="26" height="30" border="0"></td> <td width="26" height="30"><img src="images/br.png" width="26" height="30" border="0"></td> </tr> </table> </td></tr> ~~~BeginItemsRecord~~~ <?php $okayToDisplay = 0; $file_key = 'keywords.txt'; $keywords = file($file_key); foreach ($keywords as $a) { if ((stristr("~~~ItemTitle~~~", $a) !== FALSE) || (stristr("~~~ItemDescription~~~", $a) !== FALSE)) { $okayToDisplay = 1; } } if ($okayToDisplay == 1) { ?> <tr><td><br>~~~ItemPubLongDate~~~</td></tr> <tr><td><p style="padding-left:25pt; font-weight:bold;"><a href="~~~ItemLink~~~" target="_blank">~~~ItemTitle~~~</a></p></td></tr> <?php } ?> ~~~EndItemsRecord~~~ </table> I just need to figure out why those ones keep showing up. Your help is desperately need and greatly appreciated. Thanks! Ryan Quote Link to comment Share on other sites More sharing options...
btherl Posted December 15, 2008 Share Posted December 15, 2008 Try this: foreach ($rssfeeds as $a) { include ("http://www.indianasheep.com/scripts/rss/rss2html.php?TEMPLATE=output.php&XMLFILE=".$a."&MAXITEMS=10")."<br><br>"; } That is, remove the "echo" Quote Link to comment Share on other sites More sharing options...
rndilger Posted December 15, 2008 Author Share Posted December 15, 2008 That fixed it! I knew it would be something small like that. Ryan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.