I've adapted the code found here http://www.w3schools.com/php/php_ajax_rss_reader.asp to turn XML into HTML, and it works fine.
But what I'm stuck on is getting it to show all the items in a feed when the feed can have varying numbers of items. The feed is published daily and can have anywhere from 12-20 articles in it, and I want to show all of them.
In the For Loop for ($i=0; $i<=12; $i++)
if I set the condition to be greater than the number of articles, I get an error PHP Fatal error: Call to a member function getElementsByTagName()
, so I can't just set it to a big number.
I get the same error if I just remove the condition.
I can't figure out how to count the number of items, either; if I could do that the solution would be easy.
The feed is created in-house so I could ask my colleague to insert the number of items in the feed; is that the best way to go about it?
Thanks!