The Astrobar  

Go Back   The Astrobar > General > The Bar
FAQ The Drunks Calendar Arcade Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old 06-14-2005, 08:55 PM   #1 (permalink)
"It's a faaaake!"
 
Space Goat's Avatar
 
Join Date: Jan 1970
Location: Washington, D.C.
Posts: 432
Space Goat is on a distinguished road
Send a message via AIM to Space Goat Send a message via MSN to Space Goat

Default Niggling RSS question

For my new Hypersyllogistic web site, I've followed Gitch's suggestion on TrekWeb that I implement an RSS feed. But, for some reason, when I use Bloglines--which I guess is a fairly good RSS reader--only the first four entries in my article database show. Articles after that don't appear. Why might this be the case? I'm reproducing my code below, in case that might help:

Code:
<?php
header('Content-type: text/xml');
require '../includes/database.php';
?>
<rss version="2.0">
<channel>
<title>Hypersyllogistic: A Home for Politics without Histrionics</title>
<description>Hypersyllogistic features commentary and argument about politics and current events. Read screeds from the site's creator, Jason Vines, and then sound off on the forums!</description>
<link>http://www.hypersyllogistic.com</link>
<copyright>Jason Vines, 2000-2005.</copyright>

<?php
$query = "SELECT UNIX_TIMESTAMP(screed_time) AS time, DAYOFYEAR(screed_time) AS day, screed_title FROM screeds ORDER BY time DESC LIMIT 0, 10";
$result = mysql_query($query);
$array = mysql_fetch_array ($result);

while ($array = mysql_fetch_array ($result)) {
	$time = strftime("%a, %d %b %Y %T %Z",$array['time']);
	$day = $array['day'];
	$screed_title = strip_tags($array['screed_title']);
?>

	
	<item>
	<title><?php print htmlentities($screed_title, ENT_QUOTES); ?></title>
	<link>http://www.hypersyllogistic.com/pastscreed.php?id=<?php print $day; ?></link>
	<pubDate><?php print $time; ?></pubDate>
	</item>
	
<?php
}
?>

</channel>
</rss>
The weirdest thing is, the query I use in the file retrieves all of my articles in phpmyadmin.

I guess Bloglines could be what's screwing up; if that's the case, can anyone recommend a good RSS aggregator?

EDIT: Here's a link to my RSS feed in question: http://www.hypersyllogistic.com/rss/rss.xml

I've used an .htaccess file to make my server parse .xml files in the rss directory as .php files.
__________________
"People should not be afraid of their governments. Governments should be afraid of their people." -V for Vendetta

"Don't tell me what I can't do!" -John Locke, Lost

Visit me on the web: Hypersyllogistic | Flickr | Twitter


Space Goat is offline   Reply With Quote
Old 06-14-2005, 11:02 PM   #2 (permalink)
Consultant Fellationist
 
Gitch's Avatar
 
Join Date: Dec 1969
Location: God's own country merry England
Posts: 435
Gitch is on a distinguished road

Default

I'd hate to give the impression that I have the faintest idea how RSS works - I simply ticked the "add to RSS feed" tickbox on my provider ;-)
__________________


If masturbation is self-abuse - you are obviously doing it wrong.
Gitch is offline   Reply With Quote
Old 06-15-2005, 12:05 PM   #3 (permalink)
Astro-Monkey
 
Arik's Avatar
 
Join Date: Jan 2010
Location: Here, dumbfuck!
Posts: 2,304
Arik has disabled reputation
Send a message via AIM to Arik Send a message via MSN to Arik Send a message via Yahoo to Arik

Default

A little bit of debugging...

Code:
 <?php
 header('Content-type: text/xml');
 require '../includes/database.php';
 ?>
 <rss version="2.0">
 <channel>
 <title>Hypersyllogistic: A Home for Politics without Histrionics</title>
 <description>Hypersyllogistic features commentary and argument about politics and current events. Read screeds from the site's creator, Jason Vines, and then sound off on the forums!</description>
 <link>http://www.hypersyllogistic.com</link>
 <copyright>Jason Vines, 2000-2005.</copyright>
 
 <?php
 $query = "SELECT UNIX_TIMESTAMP(screed_time) AS time, DAYOFYEAR(screed_time) AS day, screed_title FROM screeds ORDER BY time DESC LIMIT 0, 10";
 $result = mysql_query($query);
 $array = mysql_fetch_array ($result);
 $numResults = mysql_num_rows($result);
 $numInArray = count($array);
 $numIterations = 0;
 
 echo 'Number of rows returned: ' . $numResults;
 echo ' Numer of items in the array: ' . $numInArray;
 
 while ($array = mysql_fetch_array ($result)) {
         $numIterations++
 	$time = strftime("%a, %d %b %Y %T %Z",$array['time']);
 	$day = $array['day'];
 	$screed_title = strip_tags($array['screed_title']);
 ?>
 
 	
 	<item>
 	<title><?php print htmlentities($screed_title, ENT_QUOTES); ?></title>
 	<link>http://www.hypersyllogistic.com/pastscreed.php?id=<?php print $day; ?></link>
 	<pubDate><?php print $time; ?></pubDate>
 	</item>
 	
 <?php
 }
 echo 'The while loop went for ' .  $numIterations . ' iterations';
 ?>
 
 </channel>
 </rss>
How many items are being returned from the query and how many are being put into the array? How many iterations is the while loop really going for?
__________________
The writers of this post apologize for you being too stupid to understand it.

Arik is offline   Reply With Quote
Old 06-15-2005, 02:40 PM   #4 (permalink)
"It's a faaaake!"
 
Space Goat's Avatar
 
Join Date: Jan 1970
Location: Washington, D.C.
Posts: 432
Space Goat is on a distinguished road
Send a message via AIM to Space Goat Send a message via MSN to Space Goat

Default

Thanks so much for the help, Arik.

Here are the results I received. http://www.hypersyllogistic.com/rss/rsstest.xml

Quote:
Number of rows returned: 5
Numer of items in the array: 6
The while loop went for 4 iterations
The number of rows is right; that's how many articles I have in my screeds table now. But why would the while loop only run four times and then quit?
__________________
"People should not be afraid of their governments. Governments should be afraid of their people." -V for Vendetta

"Don't tell me what I can't do!" -John Locke, Lost

Visit me on the web: Hypersyllogistic | Flickr | Twitter


Space Goat is offline   Reply With Quote
Old 06-16-2005, 11:31 AM   #5 (permalink)
Astro-Monkey
 
Arik's Avatar
 
Join Date: Jan 2010
Location: Here, dumbfuck!
Posts: 2,304
Arik has disabled reputation
Send a message via AIM to Arik Send a message via MSN to Arik Send a message via Yahoo to Arik

Default

Quote:
Agamemnon stopped drinking long enough to mumble
Thanks so much for the help, Arik.

Here are the results I received. http://www.hypersyllogistic.com/rss/rsstest.xml


The number of rows is right; that's how many articles I have in my screeds table now. But why would the while loop only run four times and then quit?
Because you're burning the first item your query is returning...

Take out the first

Code:
 $array = mysql_fetch_array ($result);
That should work better.
__________________
The writers of this post apologize for you being too stupid to understand it.

Arik is offline   Reply With Quote
Old 06-16-2005, 01:16 PM   #6 (permalink)
"It's a faaaake!"
 
Space Goat's Avatar
 
Join Date: Jan 1970
Location: Washington, D.C.
Posts: 432
Space Goat is on a distinguished road
Send a message via AIM to Space Goat Send a message via MSN to Space Goat

Default

Thanks so much, Arik, my RSS feed appears to be working fine now.
__________________
"People should not be afraid of their governments. Governments should be afraid of their people." -V for Vendetta

"Don't tell me what I can't do!" -John Locke, Lost

Visit me on the web: Hypersyllogistic | Flickr | Twitter


Space Goat is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:27 AM.


Powered by vBulletin® Version 3.7.0 Beta 4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0