I'm trying to implement a search filter on a Laravel project. As I'm currently storing all the content of a page together through a WYSIWYG editor, the problem I'm facing now is how to get only the "p" tags on the content of the pages I retrieve from the database. I already tried a few things but nothing is working. Can anyone point me in the right direction? Here is what I'm trying so far:
<div id="page-content" class="container">
  @foreach($searchResults as $searchResult) 
    <div class="searchResult_div col-xs-12">
      <div class="col-xs-9 col-sm-10 search-result-body">   
      <?php
      $sr = HTML::decode($searchResult['body'], 450, "...");
      $dom = new DOMDocument();
      @$dom->loadHTML($sr);
      $sr_text = $dom->getElementsByTagName("p");
      echo $sr_text;
      ?>
      </div>
    </div>
  @endforeach   
</div>
Error: Object of class DOMNodeList could not be converted to string (View: /Users/ruirosa/Documents/AptanaStudio3Workspace/Marave4/app/views/search/search.blade.php)
 
    
