Jump to content

[SOLVED] troubleshooting aberrent output


rndilger

Recommended Posts

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.