i wondering if possible nest templates inside of templates in laravel 4. have master wrapper template include things doctype, header , footer , able load in templates master templates body section.
this give me flexibility of having nested template application pages without having duplicate code while giving me ability use master template non-application pages.
can please provide example how done using blades templating engine? possible pass in value router , have value pushed down nested template?
edit:
here code index.blade.php
@extends('layouts.master') @section('title') page @endsection @section('content') @include('layouts.app') @endsection
you can try multiple level nesting
//index.blade.php @extends('layouts.master') @section('title') @parent :: new title @stop @section('content') <p>some static contents here</p> @stop //app.blade.php @section('content') @parent <p>add here ever want add</p> @stop either route or controller can nest index , app, ex- return view::make('index')->nest('content','layouts.app');
and in case want pass data child view can passing data third parameter nest()
return view::make('index')->nest('content','layouts.app',$data);
Comments
Post a Comment