PHP Geek
PHP Geek

Reputation: 4033

Extending the header and footer in laravel

I am using laravel 5.2 to create a new project. As i am new in the laravel. so I am creating new page and directory structure is as follows:

-views
   - layouts
    - default.blade.php
   - page
    - index.blade.php
   - templates -common
    - header.blade.php
    - footer.blade.php

Now in page/index.blade.php I need to extend the default layout. my codes are as below.. LAYOUTS/DEFAULT.BLADE.PHP

@include('templates.common.header')
@yield('section')
@include('templates.common.footer')

and in index page i have defined the section but resulting the error as follows:

FatalErrorException in 1d36838b56f16e2e06a8567cdd5270af26ec6aa8.php line 1: syntax error, unexpected '__data' (T_STRING)

Please suggest me some solutions.... Thank you

Upvotes: 0

Views: 7519

Answers (1)

user3720250
user3720250

Reputation: 44

in your structure templates - header.blade.php - footer.blade.php no directory common in templates, which is in

@include('templates.common.header')

Also check you have at first line in index.php: @extends('layouts.default')

Upvotes: 2

Related Questions