Home > Software design >  Error Display: Syntax error, unexpected token "<" When dynamic the page title in larave
Error Display: Syntax error, unexpected token "<" When dynamic the page title in larave

Time:06-03

I am make a page title dynamic if title is set in page then display it otherwise display default title

Here is below code

<title>
@yield({{ 
      @if(isset($title))
        $title
      @else 
        "Islamabad's 1st Digital Real Estate Marketplace | Property051.com"
      @endif
      }})
</title>

@extends('front.layout.app', array('title'=> $get_society->society_name))

CodePudding user response:

You don't need yield here, just use:

<title>
@if(isset($title))
   {{ $title }}
@else 
   Islamabad's 1st Digital Real Estate Marketplace | Property051.com
@endif
</title>

CodePudding user response:

I am not sure what you are even trying to do with yield. Just putting an @ before the keyword does not automatically make it into a php code. What you are trying to do should look like this.

 <title>
<?php  
      if(isset($title)){
          echo $title;
      }
      else {
        echo "Islamabad's 1st Digital Real Estate Marketplace | Property051.com";  
      }
       
      
      ?>
</title>
  • Related