Jump to content

The_WJM

New Members
  • Posts

    2
  • Joined

  • Last visited

The_WJM's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Oh so close. It outputs in 3 columns, however, it just repeats the first item in the feed.
  2. I want to loop a RSS feed into a table and with a maximum of 3 columns. Example: Feed retrieves 12 items, insert into table of 3 columns X 4 rows. 24 items retrieved, 3 columns X 8 rows, etc. I've figured out how to specify maximum number of items to retrieve and display in a table format, but I don't know how to limit the number of columns to begin a new row. Here's what I have: <table border="1"> <tr> <?php $rss = new DOMDocument(); $rss->load('http://pipes.yahoo.com/pipes/pipe.run?_id=e9ba5a52dfb7a537fa537445c6031349&_render=rss'); $feed = array(); foreach ($rss->getElementsByTagName('item') as $node) { $item = array ( 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, ); array_push($feed, $item); } $limit = 12; for($x=0;$x<$limit;$x++) { $title = str_replace(' & ', ' & ', $feed[$x]['title']); $link = $feed[$x]['link']; $description = $feed[$x]['desc']; echo '<td><a href="'.$link.'" title="'.$title.'">'.$title.'</a><br />'.$description.'</td>'; } ?> </tr> </table>
×
×
  • 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.