Laravel Template Help!

Asked

Viewed 86 times

2

I have two Blade.php files and I’m not being able to see the content in the browser.

@extends('layouts.index')

   @section('content')
   @parent
     <div class="container">
         <div class="row">
             <div class="col-lg-12 text-center">
        <p>Copyright &copy; Your Blog 2016</p>
          </div>
        </div>
     </div>

    @stop

<footer>
      @yield('content')
</footer>
  • Not so. Your template file should be separated from the content file. In the content you call extends templates.

  • I put so just to show issue Yield and extends

1 answer

1

master.blade.php

<!DOCTYPE html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
    </head>
    <body>

        @yield('content')

    </body>
</html>

content.blade.php

@extends('layouts.master')

@section('content')
    <h1>Teste de Template</h1>   
@stop

You need to have a Controller and a Route.

You must already have a Model Controller, use it.

Seucontroller.php

public function getIndex(){ 
   return view('frontend.pagina');
}

Filing cabinet Routes.php

Route::controller("/", "SeuController");

Access:

http://localhost/seu_site/public

  • It hasn’t worked here yet. I’m starting Windows, I have to create a Controller or don’t need ?

  • I don’t know what that is. It didn’t work.

  • You know how to program in Pure PHP or OO ?

  • Yes, I have experience.

  • But you said you don’t know what it is. Don’t know what Controller, Route ? What you don’t know ?

  • I don’t know why this is happening.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.