lundi 2 novembre 2015

Blade passing values from view to master and then pass it to header.blade

I have a situation where i have a view file users.blade.php which extends master. and the master includes another file called header.blade.php, i want to pass some data from users.blade to header.blade.

Here is the simplified version of the files

/****** Users.blade.php *********/
@extends('shared.master')
@section('title', 'Dashboard')

@section('pagecss')
    <link rel="stylesheet" href="links to css file" />
@endsection

Here is the master.blade.php

/******Shared/master.blade.php ********/
<html>
    <head>
        <title>@yield('title')</title>
        @include('shared.header')
    </head>
    <body >

        @yield('content')

    </body>
</html>

Here is the header file

/******Shared/header.blade.php ********/
<link rel="stylesheet" href="links to bootstrap" />
@yield('pagecss')
<link rel="stylesheet" href="links to other files" />

@yield('pagecss') doesn't work in the header.blade, but it does work in master.blade. Now i cant paste it in master.blade because there are some files which override other files, so it has to be in a specific order. Any ideas how to make the yield work in header.blade?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire