简体   繁体   中英

Blade template inclusion issue in laravel

I have a php file which is in the name of index.blade.php In that I have included another page like "xyz.php".

I have included "xyz.php" in index.blade.php using @include('xyz').

When I am trying to include another php file inside xyz its not working.

Please find my source code below

index.blade.php

<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>My Laravel page</title>    
      <link href="{{ Config::get('ipvars.filepath') }}assets/netbramha/css/bootstrap.min.css" rel="stylesheet">
  <link href="{{ Config::get('ipvars.filepath') }}assets/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" >
  <!-- Font icon -->

   </head>
   <body>

    @include('xyz')

xyz.php

<div>
@include('footer')
</div>
</body>
</html>

This footer content not included properly. Its shows like @include('footer') in source code

@include('footer') will not work on xyz.php . As template engine will not work on this page.

You can cheange the file name to xyz.blade.php and get it working.

Or use php function instead of directives on xyz.php .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM