0

Im working in PHP Laravel to build an RSS FEED READER

I have read the XML file and it displays the title, description and link. But the description contains image which i don't know how to display as an image. Now the image part comes in html format as shown below:

enter image description here

Instead i want it to be displayed like this:

enter image description here

Here is my html code where the rss feed content display happens:

 @foreach ($feed->item as $item)
        <tbody>
          <div class="card">
            <div class="card-header">
              <a href="{{ $item->link }}">{{ $item->title}}</a>
            </div>

            <div class="card-header">
              <a href="{{ $item->link }}">{{ $item->thumbnail}}</a>
            </div>
            <div class="card-body">
              {{$item->description}}
            </div>
          </div>
        </tbody>
        @endforeach

Can somebody please help me with this. Thanks in advance.

1 Answer 1

0

You have HTML in your $item->description using the double Mustache{{ }} You are telling Laravel escape the data.

To render the HTML, you need to use instead {!! !!}

    <div class="card-body">
      {!! $item->description !!}
    </div>

You can see more in the doc here: https://laravel.com/docs/7.x/blade#displaying-data

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.