Quantcast
Channel: Display RSS feed with Laravel PHP using SimpleXML - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Display RSS feed with Laravel PHP using SimpleXML

0
0

I want to display a RSS feed, keeping it as simple as possible.

I am using Laravel 4.Here is my controller :

public function getHome(){    $content = file_get_contents('http://rss.leparisien.fr/leparisien/rss/paris-75.xml');    $flux = new SimpleXmlElement($content);    return View::make('frontend/homepage', compact('flux'));}

And here is my view :

@foreach ($flux as $flu)<article class="entry-item"><img src="{{utf8_decode((string)$flu->item->enclosure['url'])}}" alt=""><div class="entry-content"><a href="{{ $flu->item->link }}">{{ $flu->item->title }}</a>            {{ $flu->item->description }}</div></article>@endforeach

This is working fine, but only one article (item) is shown.I tried to find a way to get several items displayed with SimpleXMLElement::attributes

I can't find any clear tutorial about it.


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images