Laravel view, layout and variables transfer

MiSs MeOw

New Member
my laravel view structure is like this:\[code\] /views/layouts/default.blade.php\[/code\]containing \[code\]<html>@yield('header')<body> @yield('navigation') @yield('content') @yield('footer')</body>\[/code\]following by\[code\]/views/partials/footer.blade.php/views/partials/header.blade.php/views/partials/navigation.blade.php\[/code\]In my header view i have a var $titleI'm trying to set it dynamically trought the controller on the home page.so in my view located in /pages/index.blade.phpI got this \[code\]@layout('layouts.default')@section('header') @render('partials.header')@endsection@section('navigation') @render('partials.menu')@endsection@section('footer') footer@endsection@section('content')@endsection\[/code\]I read somewhere that the title var should be passed throught the controller but i can't do it :(i tried this without any success.$title is undefined in header partials views..\[code\]class Home_Controller extends Base_Controller { public $layout = 'layouts.default'; public function action_index() { $this->layout->nest('header', 'home.index')->with('title', 'James'); $posts = Post::with('author')->all(); return View::make('home.index'); }\[/code\]
 
Back
Top