Laravel 4 layout not showing

I am having trouble presenting a view in my controller. I am currently running Laravel 4, and below is my code. (By the way, I'm still studying Laravel, in particular, the latest version that has not yet been released. It seems to me that it’s nice to learn from older versions, because there seem to be a lot of changes for the current one.)

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 / Templates / 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> 
+6
source share
2 answers

you should use @extends instead of @layout and @stop instead of @endsection

+15
source

Using @extends instead of @layout solved my problem.

+8
source

Source: https://habr.com/ru/post/945855/


All Articles