Search the Community
Showing results for tags 'pipe'.
-
So a little background I have to create a RSS feed for a crawl for a monitor wall above out studios news desk that only accepts the description field so I have made a page that takes another RSS feed and only displays the description field and adds some spaces then a pipe with a few more spaces and makes it all CAPS Making it look like this CRAWL ITEM 01 | CRAWL ITEM 02 | CRAWL ITEM 03 | The problem is I need the get rid of the ending pipe Making it look like this CRAWL ITEM 01 | CRAWL ITEM 02 | CRAWL ITEM 03 This is what I have so far If anyone can show me how to get rid of the ending pipe would be great. I have read about the implode function but don’t know how to implement it I and very novice with php, most of the code I got off another forum And yes a lot of things are commented out incase I need then in the future Thx <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <?php $rss = new DOMDocument(); $rss->load('http://site.com/temp/rss_clean_feed/sample.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, 'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue, ); array_push($feed, $item); } $limit = 8; for($x=0;$x<$limit;$x++) { $title = str_replace(' & ', ' & ', $feed[$x]['title']); #$link = $feed[$x]['link']; $description = $feed[$x]['desc']; $description = strtoupper($description); #$date = date('l F d, Y', strtotime($feed[$x]['date'])); echo '<item>' . "\n"; #echo '<title>'.$title.'</title>'; echo '<description>'.$description.' | '; echo '</description>' . "\n"; echo '</item>' . "\n"; } ?> </channel> </rss>