2013-05-26 10 views
6

Mam problem z renderowaniem widoku w moim kontrolerze. Obecnie korzystam z Laravel 4, a poniżej mój kod. (BTW, wciąż uczę się Laravel szczególnie najnowszej wersji, która nie została jeszcze wydana.) Uważam, że nie jest to dobry pomysł, aby uczyć się od starszych wersji, ponieważ wydaje się, że jest wiele zmian w obecnej wersji.)Układ główny Laravel 4 bez renderowania

controllers/PluginsController.php

class PluginsController extends BaseController { 
    public function index() 
    { 
     return View::make('plugins.index')->with(array('title'=>"The Index Page")); 
    } 

views/plugins/index.blade.php

@layout('templates.master') 

@section('header') 
    <h1>The Header</h1> 
@endsection 

@section('content') 
    testing the index.blade.php 
@endsection 


@section('footer') 
    <div style="background:blue;"> 
     <h1>My Footer Goes Here</h1> 
    </div> 
@endsection 

views/szablony/master.blade.php

<!doctype> 
<html> 
    <head> 
     <meta charset="UTF-8" /> 
     @yield('meta_info') 
     <title>{{$title}}</title> 
     @yield('scripts') 
    </head> 
    <body> 
     <div id="header"> 
      @yield('header') 
     </div> 

     <div id="wrapper"> 
      @yield('content') 
     </div> 

     <div id="footer"> 
      @yield('footer') 
     </div> 
    </body> 
</html> 
+0

Tak dobre pytanie, miałem ten sam problem – M98

Odpowiedz

8

Zamiast @layout rozwiązałem mój problem.

15

należy użyć @extends zamiast @layout i @stop zamiast @endsection