I am having trouble rendering a view in my controller. I am currently running Laravel 4 and below is my code. (BTW, I am still learning Laravel particularly the latest version that has not been released yet. I find it a bad idea to learn from the older versions because there seems 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>
you must use @extends
instead of @layout, and @stop
instead of @endsection
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With