lundi 27 mars 2017

Laravel if else statement

I´m trying to output 2 different things. For example: if title is greater then 0 then do this. If not, do this.

I'm using DomDocument & Laravel 5.4

In my controller:

$title = $dom->getElementsByTagName('title');

To output on the page:

@foreach ($title as $node)
 @if(!$node > 0)
  No title
   @else
     <br />
  @endif
@endforeach

The problem: If there is a title it displays the title. If there is no title it shows nothing. I want to display: "No title".

Why isn't this working?

Aucun commentaire:

Enregistrer un commentaire